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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 017

Post by jaap »

phillip1882,
I saw the code you posted before it was removed. Your problem lies in how you handle the number 100.
Doro_91
Posts: 1
Joined: Mon Feb 21, 2011 9:01 pm

Re: Problem 017

Post by Doro_91 »

I'm going crazy. I've been looking over my code (java) about 2 hours and to me it's correct. but it gives not the correct solution. so i ask: may anyone of you look over my code? cause i do not understand what's wrong..
User avatar
Jochen_P
Posts: 55
Joined: Mon Oct 05, 2009 10:47 am
Location: Stuttgart, Germany

Re: Problem 017

Post by Jochen_P »

Yeah, please send it.. I am curious If I am able to spot the looney in an unfamiliar language.. (no guarantuee)
Image
N1ghtly
Posts: 1
Joined: Sun Jan 16, 2011 5:06 pm

Re: Problem 017

Post by N1ghtly »

Hello everybody,

I've been debugging my code 2+ hours, still without a correct answer.
I gave up and cheated, and I seem to bet getting 10 too low.
I have absolutely no idea!
Can I please send my code to someone, maybe you can spot the error :p
Barsy
Posts: 1
Joined: Wed Apr 27, 2011 9:42 am

Re: Problem 017

Post by Barsy »

Hello,

I cannot find the right answer and I think the problem come from the language.

Can someone cofirm that the sum of letters from 1 to 500 is : 9774 ?

Is there exceptions in the language ? The writting for following numbers is correct ?
100 : one hundred (10)
200 : two hundred (10)
215 : two hundred and fifteen (20)
407 : four hundred and seven (19)
694 : six hundred and ninety four (23)

Thank you for your help

PS : It's OK, I solved the problem. It's seem I made a mistake counting letters in the word "fourteen"... :?
Image
pytom
Posts: 2
Joined: Mon May 30, 2011 7:53 am

Re: Problem 017

Post by pytom »

this one is ok~ :D

Code: Select all

code snipped by hk
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Problem 017

Post by Lord_Farin »

pytom wrote:this one is ok~ :D

Code: Select all

[Snip]
In fact, it is not. The bright red box above this forum should tell you (and should've in advance) that posting such results is **NOT** allowed. Please, remove your code.
Image
pytom
Posts: 2
Joined: Mon May 30, 2011 7:53 am

Re: Problem 017

Post by pytom »

Lord_Farin wrote:
pytom wrote:this one is ok~ :D

Code: Select all

[Snip]
In fact, it is not. The bright red box above this forum should tell you (and should've in advance) that posting such results is **NOT** allowed. Please, remove your code.
sorry, terrible sorry~ :( i make a mistake~
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: Problem 017

Post by Lord_Farin »

pytom wrote: sorry, terrible sorry~ :( i make a mistake~
Mistakes are good. They keep us human 8-) Thanks for your apologies.
Image
m34tcode
Posts: 4
Joined: Sun May 22, 2011 8:02 pm

Re: Problem 017

Post by m34tcode »

lol im epic failing. been trying to figure out for days y its not working.

Code: Select all

one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
..
thirty
fourty
fifty
sixty
seventy
eighty
ninety
n-hundred
onethousand
EDIT: lol browsers spell-correct feature showed me that fourty is spelled as 'forty' lol. got it =]
browndar
Posts: 2
Joined: Sun Jun 19, 2011 9:54 pm

Re: Problem 017

Post by browndar »

I think eighteen and eighty may be other culprits.
kholdstare13
Posts: 1
Joined: Tue Jun 21, 2011 7:06 pm

Re: Problem 017

Post by kholdstare13 »

I would like to point out that the proper U.S. and Canadian number system reserves the word "and" only for FRACTIONAL numbers, not those represented with a decimal point, and digits following a decimal point are pronounced separately unless treated as a fraction. For example,

1 1/2: One and one half
1.5: One point five
102.123 One hundred two point one two three
3.14 Three point one four (In order to pronounce "fourteen" it must be stated as "three and fourteen hundredths")

It is lso interesting to note that "hundredth(s)" is the only fraction not to require the word "one", as in "one hundred fiftieths" (X/150). Is this also true in British?

How would British people pronounce the following?
987,123 456/705: Nine hundred AND eighty seven thousand one hundred AND twenty three AND four hundred AND fifty six seven hundred AND fifths?
(American: Nine hundred eighty seven thousand one hundred twenty three AND for hundred fifty six seven hundred fifths)
Do you use some word other than "and" to separate integers from fractions?

Luckily this problem is only up to 1000 or we might have to deal with the dilemma of British numbers over 999,999,999.
garethrees
Posts: 7
Joined: Fri Sep 03, 2010 12:19 pm

Re: Problem 017

Post by garethrees »

In the UK, we almost never talk about large improper fractions, so it does not matter very much that a phrase like "one hundred and three quarters" is ambiguous between 103/4 and 403/4 (which indeed it is). For real world numbers, we tend to use decimal, so we'd say "twenty-five point seven five" or "one hundred point seven five". For the few cases where we do use improper fractions (for example, ages of young children, clothing sizes, "platform nine and three quarters"), the numbers tend to be small enough that there is in practice no ambiguity. Maybe things are different elsewhere in the world.

There is no dilemma about names for large numbers in the UK. 10**9 is a "billion" and has been so for at least forty years. The very last holdouts for the "long scale" (10**12) billion gave up in the mid-1970s.
kapila_619
Posts: 3
Joined: Mon Jun 27, 2011 2:29 pm
Location: India

Re: Problem 017

Post by kapila_619 »

Hi,
can anyone see my code in python

I have gone over it many times but cannot find the mistake

edit : done !!
Last edited by kapila_619 on Thu Jul 07, 2011 9:39 am, edited 1 time in total.
User avatar
Slaunger
Posts: 40
Joined: Tue Jul 20, 2010 12:23 am

Re: Problem 017

Post by Slaunger »

Feel free to send me your code, and I will try to help.
Image
Ulkor
Posts: 1
Joined: Thu Jul 07, 2011 8:25 am

Re: Problem 017

Post by Ulkor »

Thanks to this thread I am now aware of the fact that it's forty, not fourty. :shock:

Should I be happy I or should I feel ashamed? :lol:
sh4ring4n
Posts: 1
Joined: Sun Nov 20, 2011 10:10 pm

Re: Problem 017

Post by sh4ring4n »

I have most of it down, but I can't seem to pinpoint the answer, and how my code is wrong.
User avatar
ComSciGuy
Posts: 3
Joined: Sun Jul 22, 2012 11:42 pm

Re: Problem 017

Post by ComSciGuy »

After reading all of the posts and double checking my spelling, I am still getting the wrong answer. Below is a sample of the output. My code outputs 19 for 1-5 and does 115 and 342 correctly.

Code: Select all

1: one (3)
2: two (3)
3: three (5)
4: four (4)
5: five (4)
6: six (3)
7: seven (5)
8: eight (5)
9: nine (4)
10: ten (3)
11: eleven (6)
12: twelve (6)
13: thirteen (8)
14: fourteen (8)
15: fifteen (7)
16: sixteen (7)
17: seventeen (9)
18: eighteen (8)
19: nineteen (8)
20: twenty (6) ...
30: thirty (6) ...
40: forty (5) ...
50: fifty (5) ...
60: sixty (5)
70: seventy (7) ...
80: eighty (6) ...
90: ninety (6)...
100: onehundred (10)
101: onehundredandone (16) ...
115: onehundredandfifteen (20) ...
342: threehundredandfortytwo (23) ...
998: ninehundredandninetyeight (25)
999: ninehundredandninetynine (24)
1000: onethousand  (12)
Am I missing something simple here. Thanks.

Edit: Thanks to mdean for providing a fresh set of eyes. Note: The error was an extra space after the "thousand"
loucmu
Posts: 2
Joined: Mon Apr 07, 2014 7:16 pm

Re: Problem 017

Post by loucmu »

Damn you "eightteen"!!!!! I'm a mathematician damnit, not a speller.
User avatar
hk
Administrator
Posts: 12831
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 017

Post by hk »

For a mathematician spelling should be piece of cake. :lol:
Image
War ruins the life and health of untold numbers of innocent children.
Post Reply