Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [QUIZ] English Numerals (#25)

Reply
Thread Tools

[QUIZ] English Numerals (#25)

 
 
Ruby Quiz
Guest
Posts: n/a
 
      03-25-2005
The three rules of Ruby Quiz:

1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.

2. Support Ruby Quiz by submitting ideas as often as you can:

http://www.rubyquiz.com/

3. Enjoy!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

by Timothy Byrd

While we normally write numbers using Arabic (or since Quiz #22, Roman)
numerals, numbers can also be written out as English phrases.

For example:

7 == seven (the hard way)
42 == forty-two (a very important number)
2001 == two thousand and one (a space odyssey)
1999 == (party like it's) nineteen hundred and ninety-nine

So the quiz is a problem from a Pi Mu Epsilon (US national math club)
newsletter:

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

Your mission, should you choose to accept it, is to:

- Create Ruby code to translate a number to it's English language form. (My
sample version works with integers up to 10**72-1.)

- Determine programmatically which odd number in 1..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 it...)

- Would the answer change for a larger range of values, say 10**30?

- Do French and German Rubyists get a different answer than the Americans?

Extra credit:

-Add a Pinyin translator: http://www.mandarintools.com/numbers.html


 
Reply With Quote
 
 
 
 
Patrick Hurley
Guest
Posts: n/a
 
      03-25-2005
On Sat, 26 Mar 2005 05:18:43 +0900, Ruby Quiz <> wrote:
> The three rules of Ruby Quiz:
>
> 1. Please do not post any solutions or spoiler discussion for this quiz until
> 48 hours have passed from the time on this message.
>
> 2. Support Ruby Quiz by submitting ideas as often as you can:
>
> http://www.rubyquiz.com/
>
> 3. Enjoy!
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> by Timothy Byrd
>
> While we normally write numbers using Arabic (or since Quiz #22, Roman)
> numerals, numbers can also be written out as English phrases.
>
> For example:
>
> 7 == seven (the hard way)
> 42 == forty-two (a very important number)
> 2001 == two thousand and one (a space odyssey)
> 1999 == (party like it's) nineteen hundred and ninety-nine
>
> So the quiz is a problem from a Pi Mu Epsilon (US national math club)
> newsletter:
>
> "When the integers 1 to 10_000_000_000 are written in the English language, then
> sorted as strings, which odd number appears first in the list?"
>
> Your mission, should you choose to accept it, is to:
>
> - Create Ruby code to translate a number to it's English language form. (My
> sample version works with integers up to 10**72-1.)
>
> - Determine programmatically which odd number in 1..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 it...)
>
> - Would the answer change for a larger range of values, say 10**30?
>
> - Do French and German Rubyists get a different answer than the Americans?
>
> Extra credit:
>
> -Add a Pinyin translator: http://www.mandarintools.com/numbers.html
>
>


Ok sounds interesting, is the rule, less than 2000

1000 -> ten hundred
1800 -> eighteen hundred
2000 -> two thousand

Also what are the rules for the "and"?

1050050 -> one million fifty thousand and fifty
or
1050050 -> one million and fifty thousand and fifty

Also we hyphenate when 20 < x > 100 (and not a multple of 10)?


 
Reply With Quote
 
 
 
 
Timothy Byrd
Guest
Posts: n/a
 
      03-25-2005
> Ok sounds interesting, is the rule, less than 2000

Close. It's at least 1100 and less than 2000, so:

1000 -> one thousand
1100 -> eleven hundred
1900 -> nineteen hundred
2000 -> two thousand

> Also what are the rules for the "and"?


I was assuming the "and" only goes in the final three digits and only
if not a multiple of 100, so your:

> 1050050 -> one million fifty thousand and fifty


is what I'd pick.

> Also we hyphenate when 20 < x > 100 (and not a multple of 10)?


Yes, between 20 and 100 (non-inclusive). This applies to each group of
three digits, so:

57057057 -> fifty-seven million fifty-seven thousand and fifty-seven

Hope that clears things up.

BTW, here's a fun-fact on the original post:

7 == seven (the hard way)

In the dice game craps, a "hardway" bet is that a number
will come up as a pair rather than some other combination.
For example a six would have to be a pair of 3's rather than
5 & 1 or 4 & 2. Sevewn the hard way would require rolling a
pair of 3.5's, which is generally considered quite difficult.
(See http://stuffo.howstuffworks.com/craps7.htm )

-- Timothy

 
Reply With Quote
 
Hal Fulton
Guest
Posts: n/a
 
      03-25-2005
Hans Fugal wrote:
> Patrick Hurley wrote:
>
>> Also what are the rules for the "and"?
>>
>> 1050050 -> one million fifty thousand and fifty
>> or
>> 1050050 -> one million and fifty thousand and fifty
>>
>> Also we hyphenate when 20 < x > 100 (and not a multple of 10)?

>
>
> I was always taught there is no and (except at the decimal place), e.g.
> one million fifty thousand fifty and five tenths. I don't remember who
> taught this but I remember learning it disctinctly.


I was taught this, too. They stressed it, in fact, as though it
were something that actually mattered.

> That hyphenation thing gives me a headache. What's wrong with
> one hundred twenty five?


I have never seen "twenty five" in English -- AFAIK it's always
hyphenated.


Hal





 
Reply With Quote
 
Joe Van Dyk
Guest
Posts: n/a
 
      03-25-2005
Ruby Quiz wrote:
> The three rules of Ruby Quiz:
>
> 1. Please do not post any solutions or spoiler
> discussion for this quiz until 48 hours have passed from
> the time on this message.
>
> 2. Support Ruby Quiz by submitting ideas as often as you
> can:
>
> http://www.rubyquiz.com/
>
> 3. Enjoy!
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=
>
> by Timothy Byrd
>
> While we normally write numbers using Arabic (or since
> Quiz #22, Roman) numerals, numbers can also be written
> out as English phrases.
>
> For example:
>
> 7 == seven (the hard way)
> 42 == forty-two (a very important number)
> 2001 == two thousand and one (a space odyssey)
> 1999 == (party like it's) nineteen hundred and ninety-nine


Why is one "two thousand and one" and one "nineteen hundred and
ninety-nine"?

>
> So the quiz is a problem from a Pi Mu Epsilon (US
> national math club) newsletter:
>
> "When the integers 1 to 10_000_000_000 are written in the
> English language, then sorted as strings, which odd
> number appears first in the list?"
>
> Your mission, should you choose to accept it, is to:
>
> - Create Ruby code to translate a number to it's English
> language form. (My sample version works with integers up
> to 10**72-1.)
>
> - Determine programmatically which odd number in
> 1..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 it...)
>
> - Would the answer change for a larger range of values,
> say 10**30?
>
> - Do French and German Rubyists get a different answer
> than the Americans?
>
> Extra credit:
>
> -Add a Pinyin translator:
> http://www.mandarintools.com/numbers.html




 
Reply With Quote
 
Timothy Byrd
Guest
Posts: n/a
 
      03-25-2005
> I was always taught there is no and (except at the decimal
> place), e.g. one million fifty thousand fifty and five tenths.
> I don't remember who taught this but I remember learning it
> disctinctly.


Well, numbers aren't really exact things, after all.

I wanted to put a little twist into the quiz, and "two thousand and
one" simply sounds right. (Though I had to break 1776 to get it.)

Here's a page with more info:

http://www.absoluteastronomy.com/enc...in_English.htm

-- Timothy

 
Reply With Quote
 
Hal Fulton
Guest
Posts: n/a
 
      03-25-2005
Timothy Byrd wrote:
>>I was always taught there is no and (except at the decimal
>>place), e.g. one million fifty thousand fifty and five tenths.
>>I don't remember who taught this but I remember learning it
>>disctinctly.

>
>
> Well, numbers aren't really exact things, after all.
>
> I wanted to put a little twist into the quiz, and "two thousand and
> one" simply sounds right. (Though I had to break 1776 to get it.)
>
> Here's a page with more info:
>
> http://www.absoluteastronomy.com/enc...in_English.htm


The "and" is not my only problem with that page.

For example, they think "one hundred" is singular? Please.

By the way, I hear that one hundred are expected at the
next Ruby Conf...


Hal



 
Reply With Quote
 
Timothy Byrd
Guest
Posts: n/a
 
      03-26-2005
> For example, they think "one hundred" is singular? Please.
>
> By the way, I hear that one hundred are expected at the
> next Ruby Conf...


Well, "one hundred" is a good number.

(Going even more off topic.) That just reminded me of something. In
the US, the media refer to corporations in the singular - "Microsoft is
a ...". But I seem to recall reading British articles that use
"Microsoft are going to ..."

-- Timothy

 
Reply With Quote
 
Hal Fulton
Guest
Posts: n/a
 
      03-26-2005
Timothy Byrd wrote:
>>For example, they think "one hundred" is singular? Please.
>>
>>By the way, I hear that one hundred are expected at the
>>next Ruby Conf...

>
>
> Well, "one hundred" is a good number.
>
> (Going even more off topic.) That just reminded me of something. In
> the US, the media refer to corporations in the singular - "Microsoft is
> a ...". But I seem to recall reading British articles that use
> "Microsoft are going to ..."


Yes. Don't get me started.

Those are called "collective nouns." They appear singular but
act as a plural and should be treated plurally. Thus "Microsoft
are" is correct, and "Microsoft is" is a failure of the US
education system.

I can see the rationale that a corporation is a single entity.
But when it's time for a pronoun, even Americans go for the
plural -- even in the same sentence:

"Microsoft are angry, and they plan to sue." (UK/correct)
"Microsoft is angry, and it plans to sue." (at least consistent)
"Microsoft is angry, and they plan to sue." (American)


Hal



 
Reply With Quote
 
Patrick Hurley
Guest
Posts: n/a
 
      03-26-2005
On Sat, 26 Mar 2005 07:54:49 +0900, Timothy Byrd <> wrote:
> > I was always taught there is no and (except at the decimal
> > place), e.g. one million fifty thousand fifty and five tenths.
> > I don't remember who taught this but I remember learning it
> > disctinctly.

>
> Well, numbers aren't really exact things, after all.
>
> I wanted to put a little twist into the quiz, and "two thousand and
> one" simply sounds right. (Though I had to break 1776 to get it.)
>
> Here's a page with more info:
>
> http://www.absoluteastronomy.com/enc...in_English.htm
>
> -- Timothy
>
>


Ok almost done asking for information before I hide from my kids and
do the quiz

One last quesiton should'nt we have comma's between number clauses?

i.e.

1_111_111_111

one billion, one hundred eleven million, one hundred eleven thousand
and one hundred eleven

Patrick


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to make English-speaking friend to practic my poor English IchBin Java 1 03-26-2006 05:36 AM
English/English DLL =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 2 10-16-2005 10:32 AM
[SOLUTION] English Numerals (#25) Eliah Hecht Ruby 4 03-28-2005 11:08 PM
Dictionaries for English-French and English-Spanish fkissam Computer Support 2 07-14-2004 09:07 PM
AMERICAN ENGLISH vs BRITISH, CANADIAN, or AUSTRALIAN ENGLISH Proud USA Babe Digital Photography 247 10-07-2003 12:32 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57