Skip to content

sacruby/rubyquiz-english-numerals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Quiz 16: English Numerals

From "Best of Ruby Quiz"

Posed by Timothy Byrd

While we normally write numbers using Arabic numerals, numbers can also be written out as English phrases.

For example:

 	7    == seven
 	42   == forty-two
 	2001 == two thousand and one
 	1999 == one thousand nine hundred and ninety-nine

Given that, this quiz is a problem from a Pi Mu Epsilon newsletter

When the integers 1 to 10,000,000,000 are written in the English language and then sorted as strings, which odd number appears first in the list?

Your task is to do the following:

  1. Ruby code to translate a number to its English-language form. (My sample version works with integers less than 1072.)
  2. a program to determine which odd number in between 1 and 10,000,000,000 would sort first if written in English. (Brute force is the obvious solution, but the computer may have to think about the answer....)”

Excerpt From: James Edward Gray II. “Best of Ruby Quiz (for Christopher Haupt).” iBooks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published