Problem 012

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.
Prince_Mandor
Posts: 3
Joined: Mon Apr 07, 2008 2:00 pm

Problem 012

Post by Prince_Mandor »

Problem 12 has a bad choice of words in body of question.
Example there says about 7th triangular number 28. And question is "Which is the first triangle number..."
For me it was a question about numerical order of this number (7 for example), not about number itself (28 in same example). In the header of this problem on a problems list wording is more correct ("What is the first triangle number..." )
This cause misunderstanding. Especially for foreigners, who translate it literally.
User avatar
euler
Administrator
Posts: 5095
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 12, wording

Post by euler »

That's an interesting question, Prince_Mandor. In English the subtle difference between "what" and "which" when used as an interrogative pronoun, as in this case, is to do with the number of choices. For example, "What would you like?" is an open question to which possibilities are almost endless, whereas, "Which would you like?" is a closed question that implies there is a limited choice.

So should it be?
"Which is the first triangle number to have over five-hundred divisors?"
or
"What is the first triangle number to have over five-hundred divisors?"

I'm not sure!?

But whichever way I think there is another problem with the wording in that I am not convinced whether it is clear that we are referring to the position or the size of the triangle number? For example, "What is the first triangle number to have over five divisors?" Is the answer 7 or 28?
Image
impudens simia et macrologus profundus fabulae
Prince_Mandor
Posts: 3
Joined: Mon Apr 07, 2008 2:00 pm

Re: Problem 12, wording

Post by Prince_Mandor »

Sorry, I'm not native speaker, so I cannot help you here.
Just point you to the place of possible misunderstanding.

For me answer to 'What number?' is number itself, and answer to 'Which number?' must be guessed from context -- 'left one', '7th one', 'green one', 'first number in third string' etc...
Possibly just adding 'Note:' section to this problem will be enough.
User avatar
euler
Administrator
Posts: 5095
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 12, wording

Post by euler »

Prince_Mandor wrote:Sorry, I'm not native speaker, so I cannot help you here.
I am, and I can't help! :wink:

We'll see if anyone else has an insight into the correct usage.
Image
impudens simia et macrologus profundus fabulae
Helen
Posts: 3
Joined: Mon Apr 07, 2008 6:26 pm

Re: Problem 12, wording

Post by Helen »

I started working on Problem 12 yesterday, and couldn't tell which meaning was intended. But I don't think using "which" or "what" makes much difference here. I would say that the confusion arises from the line above: "We can see that the 7th triangle number, 28, is the first triangle number to have over five divisors." If, as I understand from this topic, 28 is the answer to the example question, then I think this could be resolved by changing that line to: "We can see that 28 is the first triangle number to have over five divisors."
User avatar
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

Re: Problem 12, wording

Post by ed_r »

How about:
What is the value of the first triangle number to have over five hundred divisors?
Note also (while we're being picky) the absence of any hyphen in five hundred.
!647 = &8FDF4C
User avatar
euler
Administrator
Posts: 5095
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 12, wording

Post by euler »

Perfect! Thanks, Helen and ed_r. 8-)
Image
impudens simia et macrologus profundus fabulae
User avatar
Tommy137
Posts: 238
Joined: Sun Feb 24, 2008 6:02 pm
Location: Cologne, Germany
Contact:

Re: Problem 12, wording

Post by Tommy137 »

Helen wrote:"We can see that 28 is the first triangle number to have over five divisors."
Seems like a good solution to me. Everyone should know that 28 is the 7th triangle number :D
Image
Prince_Mandor
Posts: 3
Joined: Mon Apr 07, 2008 2:00 pm

Re: Problem 12, wording

Post by Prince_Mandor »

ed_r wrote:How about:
What is the value of the first triangle number to have over five hundred divisors?
Note also (while we're being picky) the absence of any hyphen in five hundred.
Problem 25 has an opposite situation. Can you change the question of Problem 25 in similar way?
User avatar
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

Re: Problem 12, wording

Post by ed_r »

Honestly, do you really think anyone's going to type in a 1000 digit answer to that question?

You could have ...
What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
... I suppose; but then you'd need to define "index" elsewhere in the problem text. Surely it's just not worth the bother.
!647 = &8FDF4C
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 12, wording

Post by hk »

I don't think it important to change it but reading the problem statement one could simply ask
What is the smallest value of n for which Fn has 1000 digits.
As everything is defined properly before that.
Image
War ruins the life and health of untold numbers of innocent children.
User avatar
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

Re: Problem 12, wording

Post by ed_r »

Not quite properly: as currently stated, the answer to the problem should be negative! 8-)
!647 = &8FDF4C
User avatar
elendiastarman
Posts: 410
Joined: Sat Dec 22, 2007 8:15 pm

Re: Problem 12, wording

Post by elendiastarman »

true, since the fibonacci sequence extends backwards
besides, such an answer would be negative infinity because F(-infinity) has more than 1000 digits and is the least value of n
surely, anyone with enough intelligence to solve this problem would use common sense and use the positive answer for n
so it doesn't really need to be changed...
shorty_bobert
Posts: 1
Joined: Thu Apr 10, 2008 6:45 pm

Problem 12

Post by shorty_bobert »

What's the answer to problem 12 anyone?
User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: whats the answer to number 12?

Post by Georg »

The first triangle number having over five-hundred divisors.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: whats the answer to number 12?

Post by daniel.is.fischer »

In case that's the problem: the number, not the index.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
geek69
Posts: 3
Joined: Wed Nov 26, 2008 2:50 pm

Problem 12

Post by geek69 »

I hope this isn't a duplicate post - I did a quick search and nothing turned up, but I find it hard to believe I'm the first person to have noticed this.

In the PDF for problem 12, snip, the third block of example code doesn't work. Within the while loop the cnt value doesn't get reset so as it gets multiplied by 2 twice within the loop it quickly reaches 512 and exits.

Simply adding cnt=1 in the while loop fixes the problem. For example:
...
array of int: primearray[1..P]
while cnt <= 500 {
cnt = 1
a = a+1
...
pianowow
Posts: 5
Joined: Wed Nov 26, 2008 4:17 pm

Re: Problem 12

Post by pianowow »

Taking a look I see that a similar bug is in all three examples.
harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 12

Post by harryh »

I had to snip the reference to the pdf, since not everyone reading this forum has solved the problem; leading them straight to a solution wouldnot be fair, would it?

I'm sure all the examples are correct, so I'm trying to guess what exactly is confusing you...
You need to count all the divisors, not just those that include a particular prime number. So, how can you reset the counter at each prime number you examine?

PS: Apologies, I see what you mean... Thanks for pointing it out. We'll fix it soon !
geek69
Posts: 3
Joined: Wed Nov 26, 2008 2:50 pm

Re: Problem 12

Post by geek69 »

Oops! Sorry for posting the PDF - that wasn't very considerate of me. I'll know for next time.

Thanks for looking into it!
Post Reply