## Problem 017

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you
are requested to be thoughtful in not posting anything
that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one

Don't post any spoilers
Legrow
Posts: 1
Joined: Mon Aug 27, 2007 9:38 am

### Problem 017

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.
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

### Re: Problem 17 - Minor bone to pick

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!
!647 = &8FDF4C
rayfil
Posts: 1406
Joined: Sun Mar 26, 2006 5:30 am
Contact:

### Re: Problem 17 - Minor bone to pick

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.
When you assume something, you risk being wrong half the time.
euler
Posts: 3441
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

### Re: Problem 17 - Minor bone to pick

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?
Abel
Posts: 1
Joined: Tue Sep 25, 2007 9:24 pm

### Re: Problem 17 - Minor bone to pick

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 .
Zac256
Posts: 2
Joined: Sun Oct 28, 2007 10:01 pm

### Re: Problem 17 - Minor bone to pick

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
hk
Posts: 11040
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

### Re: Problem 17 - Minor bone to pick

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.
Simonious
Posts: 1
Joined: Wed Feb 06, 2008 5:08 pm

### Problem 17

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".
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

### Re: Problem 17

British site, British grammar. That's how it is.
!647 = &8FDF4C
rayfil
Posts: 1406
Joined: Sun Mar 26, 2006 5:30 am
Contact:

### Re: Problem 17

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.
When you assume something, you risk being wrong half the time.
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

### Re: Problem 17

*Eek!* - I hope you're not parodying me there, rayfil. I certainly didn't mean to do down American usage.
!647 = &8FDF4C
hk
Posts: 11040
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

### Re: Problem 17

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.
Huggz
Posts: 4
Joined: Sat Oct 11, 2008 7:12 pm

### Problem 17

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.
DJohn
Posts: 63
Joined: Sat Oct 11, 2008 12:24 pm

### Re: Problem 17

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.
Huggz
Posts: 4
Joined: Sat Oct 11, 2008 7:12 pm

### Re: Problem 17

forty is spelled correctly, all my test cases work out properly. Needless to say, I'm a tad confused.
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

### Re: Problem 17

You could PM me and I'd take a look at your code (if it's not J or something else unreadable).
Il faut respecter la montagne -- c'est pourquoi les gypa&egrave;tes sont l&agrave;.
Huggz
Posts: 4
Joined: Sat Oct 11, 2008 7:12 pm

### Re: Problem 17

Ok... another spelling error that's easy to overlook on this one is "eighteen". Only 1 't'.
stupidgeek
Posts: 2
Joined: Thu Apr 30, 2009 1:58 am

### Re: Problem 017

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.
uws8505
Posts: 58
Joined: Tue Sep 30, 2008 3:13 pm
Location: South Korea

### Re: Problem 017

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.
Math and Programming are complements
stupidgeek
Posts: 2
Joined: Thu Apr 30, 2009 1:58 am

### Re: Problem 017

Yep. You're right. Maybe I was drunk...