Page 1 of 5

Problem 017

Posted: Mon Aug 27, 2007 9:46 am
by Legrow
(Link to problem added by moderator: Problem 17 (View Problem))
Problem 17 wrote:For example, 342 (three hundred and forty-two) contains 23 letters
I'm not sure if this has been brought up here before, but that's not how you should be writing that number. The number should be written as "three hundred forty-two" -- the "and" is reserved for where the decimal place goes.

For more information on why I believe this to be the case, read http://en.wikipedia.org/wiki/Names_of_n ... d_decimals. There may be some information here that I'm not aware of -- like perhaps that British English puts "and" in seemingly random locations rather than always at the decimal point, but I thought I'd clear it up if I could.

Re: Problem 17 - Minor bone to pick

Posted: Mon Aug 27, 2007 11:33 am
by ed_r
English uses "and". Its derivative cousin, American English, doesn't. The choice of (proper) English over degenerate alternatives seems entirely appropriate for a learned web site such as Project Euler; no dumbing-down here! :D

Re: Problem 17 - Minor bone to pick

Posted: Tue Aug 28, 2007 3:46 am
by rayfil
Whether the "and" should or should not be used is totally irrelevant. The author of the problem was certainly aware of possible differences in syntax and, in order to avoid any misinterpretation or ambiguity, provided clear examples to specify which syntax had to be used to arrive at the expected answer.

Re: Problem 17 - Minor bone to pick

Posted: Thu Aug 30, 2007 3:08 pm
by euler
Legrow wrote:There may be some information here that I'm not aware of -- like perhaps that British English puts "and" in seemingly random locations rather than always at the decimal point, but I thought I'd clear it up if I could.
It's not random. We (I am from England) always place an "and" between the hundreds and the tens/units:
342 => three hundred AND forty-two
690 => six hundred AND ninety
502 => five hundred AND two

This method is consistent with large numbers, which we read this in blocks of three:
342690502 => three hundred and forty-two MILLION, six hundred and ninety THOUSAND, five hundred and two

What is interesting is that we read numbers differently before the decimal point than those after the point, which we simply read as a list of digits; we do not make reference to the place value and do not use the word "and":
6.3 => six point three - I believe that U.S. say, six and three tenths?
13.41 => thirteen point four one - U.S. say, thirteen and forty-one hundredths?

Re: Problem 17 - Minor bone to pick

Posted: Tue Sep 25, 2007 11:22 pm
by Abel
euler wrote:6.3 => six point three - I believe that U.S. say, six and three tenths?
13.41 => thirteen point four one - U.S. say, thirteen and forty-one hundredths?
Well, I just came back (from the US, I mean) and it may be different in certain areas, but when it comes to money, they sure aren't so verbose :) It is "three fifteen please" when they mean to say it is "three dollar fifteen". Likewise, when it is about math, I seem to hear "twenty-one oh thirteen" more often than I hear "twenty one and thirteen thousandths". This was for $ 3.15 and the number 21.013 respectively. In other words: you pronounce the number before the dot and after the dot separately and all is clear (and if it isn't, they say "dot", not "point").... and that's from a Dutchman :D .

Re: Problem 17 - Minor bone to pick

Posted: Sun Oct 28, 2007 10:04 pm
by Zac256
This is no minor bone - I was 'debugging' my code for nearly half an hour before I remembered that in Brittan they use the and. But, not everyone knows that they use the and in Brittan. It should be specified in the wording of the problem whether or not the and is going to be used between the hundred and the following words.

-Zac

Re: Problem 17 - Minor bone to pick

Posted: Mon Oct 29, 2007 9:14 am
by hk
There are given two clear examples in the Note.
"NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters."
So the wanted specification is given.

Problem 17

Posted: Wed Feb 06, 2008 5:13 pm
by Simonious
Correct me if I am wrong, but, "one hundred and fifteen", is not the correct written representation of 115, which is correctly read, "one hundred fifteen". As a math teacher, this is a pet peeve of mine. I realize that many people read numbers this way, but on a web site with math challenges I would prefer to see the correct written representation of numbers, which do not include the use of the word, "and".

Re: Problem 17

Posted: Wed Feb 06, 2008 5:37 pm
by ed_r
British site, British grammar. That's how it is.

Re: Problem 17

Posted: Thu Feb 07, 2008 3:49 am
by rayfil
Simonious wrote:I would prefer to see the correct written representation of numbers
Why should YOU define what is CORRECT (or what is not) when more than half the English speaking population of the world may think the opposite. You must also remember that the English language was not invented in the U.S. but was imported and adapted there by immigrants who, at the time, may not have had a level of education as high as today's population.

Re: Problem 17

Posted: Thu Feb 07, 2008 7:56 am
by ed_r
*Eek!* - I hope you're not parodying me there, rayfil. I certainly didn't mean to do down American usage.

Re: Problem 17

Posted: Thu Feb 07, 2008 7:43 pm
by hk
As it is not the first time this matter turns up a note in the problem description has been made:
http://projecteuler.net/index.php?secti ... lems&id=17
The team hope that this once and for all settles the matter.

Problem 17

Posted: Sat Oct 11, 2008 8:49 pm
by Huggz
My program for #17, according to the problem page, isn't working. But I can't figure out what's wrong with it.

Aside from the "and" are there any other British spelling difference that an American should be made aware of?

The usage of "and" should only be between hundreds and tens?

If not, #17 isn't broken is it? I've gone over my program over and over and everything appears to be spelled correctly. No spaces, no hyphens. I'm at a loss to what could be wrong. I can PM the output if need be, but I don't want to post it, because I don't want to spoil the problem.

Thanks.

Re: Problem 17

Posted: Sat Oct 11, 2008 9:35 pm
by DJohn
Do you get the right answer for the examples? 19 for 1..5, 23 for 342, and 20 for 115? Are you counting only letters, not spaces? Did you spell forty correctly?

"and" is used only between hundreds and tens or units: two hundred and thirty five, one hundred and six.

Re: Problem 17

Posted: Sat Oct 11, 2008 10:45 pm
by Huggz
forty is spelled correctly, all my test cases work out properly. Needless to say, I'm a tad confused.

Re: Problem 17

Posted: Sat Oct 11, 2008 11:09 pm
by daniel.is.fischer
You could PM me and I'd take a look at your code (if it's not J or something else unreadable).

Re: Problem 17

Posted: Sat Oct 11, 2008 11:49 pm
by Huggz
Ok... another spelling error that's easy to overlook on this one is "eighteen". Only 1 't'. :roll:

Re: Problem 017

Posted: Thu Apr 30, 2009 2:06 am
by stupidgeek
a) The first post is ridiculous - the question clearly says British usage. This is also proper Australian usage.
b)
For example, 342 (three hundred and forty-two) contains 23 letters
... fail: three (5) + hundred (7) + and (3) + forty (5) + two (3) = (21) ... Why has this not been picked up on before? Unless of course, my degree in Mathematics, with a major in Number Theory was a waste of time?
c) There should be an example for the case where there is no tens; I thought, for example, 901 should be nine hundred and one. Unless this isn't the case, my program outputs properly formed British numbers, and still got the wrong answer still =(

EDIT: I editted my code so that my point c) was validated, ie, my program now output "three hundred seven" for 307 instead of "three hundred and seven" (and, obviously all like cases [102, 906, 405, etc]). As far as I'm concerned, this is inconsistent, but it gives the correct answer. Good luck all.

Re: Problem 017

Posted: Thu Apr 30, 2009 3:43 am
by uws8505
stupidgeek wrote:three (5) + hundred (7) + and (3) + forty (5) + two (3) = (21)
Your calculation is wrong : 5 + 7 + 3 + 5 + 3 = (7+3) + (5+5) + 3 = 23. So the problem statement is right.

Re: Problem 017

Posted: Fri May 01, 2009 12:34 am
by stupidgeek
Yep. You're right. Maybe I was drunk...