Page 1 of 1
Problem 002 and 020
Posted: Fri Mar 13, 2009 2:05 pm
by Norseman
Edit: This post has been ████████ according to forum rules.
My (apparently incorrect) answer for problem 2 was ███████. I don't see how it could be incorrect, and I've since done several things to confirm it. Firstly, I saved my list of even Fibonacci numbers. [█, █, ██, ███, ███, ████, █████, ██████, ██████, ██████]. I manually confirmed my list here:
http://www.research.att.com/~njas/sequences/A000045. Every item is correct, and I'm pretty sure that Python's built in sum() function works fine. Here's the full (python) code I used:
Code: Select all
███████
███████
████████
█████
███████
████████
█████████
██████████
███████████
███████████
██████████████
█████████
██████
███████████████
█████████
██████████
█████████████████████████
█████
I don't see any reason why my answer is wrong. I've even google searched "project euler problem 2 ██████" and found other people who posted the same answer on other websites.
Similarly, I think I have the right answer for problem 20, but apparently project euler won't accept it. I simply used:
I got back ██████████████████████████████████████████████████ ██████████████████████████████████████████████████████████████████. (Space added to avoid messing up formats.) Project Euler doesn't accept this answer either, and I have no idea why it's wrong.
Can anyone tell me if these actually are wrong answers? Or, if they're not, why project Euler won't accept them?
Re: Problems 2 and 20
Posted: Fri Mar 13, 2009 2:28 pm
by quilan
Please edit your post to remove all numbers & code (as per board FAQ). As for the questions you've posted.
#2) You're missing one or more numbers. Check your code logic perhaps, and look high.
#20) You want the sum of the individual digits of 100!, not 100! itself. For example if it was asking for the digit-sum of 5!, the answer would be 1+2+0 = 3.
Re: Problems 2 and 20
Posted: Sat Mar 14, 2009 3:10 am
by Norseman
#20) Ah, ok. Problem solved.
#2) I'm not missing one or more numbers. Even if my code is wrong, you can check the list of Fibonacci numbers and manually add up the even ones until you will exceed 4 million. I have checked the list twice, first to confirm that all of my numbers were on the list, and second to confirm that there were no other even numbers between the numbers I got.
Update: Okay, the correct answer is greater than 4 million. The problem says:
Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
Either the question should be reworded to "Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed five million." or the answer should be changed.
Re: Problems 2 and 20
Posted: Sat Mar 14, 2009 3:48 am
by quilan
Norseman wrote:Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
Either the question should be reworded to "Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed five million." or the answer should be changed.
Yeah, I know what you mean, but if I recall correctly, there was some discussion about this a while back and the final consensus was to leave the wording as it stands now. I believe the correct meaning of the phrase [finding individual terms that are each <= 4m] was decided to be the most logically inferred, but you'd have to look up the thread for that.
Re: Problems 2 and 20
Posted: Sat Mar 14, 2009 9:35 am
by hk
It's as simple as this:
8 and 9 are smaller than 10. However their sum exceeds 10.
I'm no native speaker but if the sum were not to exceed 4 million I get the feeling that there should have been written
"which does not exceed 4 million."
In other words "which" can only refer to the individual terms and not to the sum.
Re: Problems 2 and 20
Posted: Sun Mar 15, 2009 2:12 am
by rayfil
hk is correct on this one. In the english language, DO is used with a plural subject (while DOES would be used with a singular subject). The word sum being singular and the expression even-valued terms being plural, there should be no ambiguity whatsoever as to which subject should be used with the plural verb.
For obvious reasons, this site has to assume that users will be sufficiently familiar with the English language and its grammar. Otherwise, it would be impossible to describe a problem in such a way that EVERYBODY unfamiliar with the language, or its grammar, would interpret the problem with ultimate clarity.
Problem 2
Posted: Wed Jun 23, 2010 12:34 pm
by greg1313
What is an "even-valued term" ?
Re: Problem 2
Posted: Wed Jun 23, 2010 1:06 pm
by Lord_Farin
A term in the sequence that is even. Thus, in the first 10 terms, the even terms are 2,8,34.
Re: Problem 2
Posted: Wed Jun 23, 2010 2:08 pm
by greg1313
Got it, thanks.
Problem two
Posted: Wed Jun 23, 2010 11:40 pm
by jnash67
Just solved problem two - "Find the sum of all the even-valued [Fibonacci] terms in the sequence which do not exceed four million."
Going through the first few pages of threads, though, they talk of a different answer. I gather that the question previously used to have the series capped at ONE million, not four million.
Might be worth pointing this out somewhere. I was wondering whether the system was erroneously accepting false answers for a bit.
Re: Problem two
Posted: Thu Jun 24, 2010 5:32 am
by rayfil
There are several problems where the limit has been modified over time. At first, this was to discourage the use of "ready made" answer lists that had been made available by some users (for whatever reason which seemed "appropriate" to them). A note is generally added to the problem description when the limit is modified, to alert members to verify if they have been working with the current limit.
Re: Problem 002 and 020
Posted: Fri Aug 13, 2010 11:39 pm
by revived_charly
The question for 002 could be rephrased as: find the sum of the even-valued terms whose sum (that is the total sum of the even valued terms) is less than or equal to 4mil. The even-valued term refers to the terms in the sequence that are even numbers e.g 2,8 and 34 are the even-valued terms from the 10 term sequence.
Re: Problem 002 and 020
Posted: Sun Aug 15, 2010 1:40 pm
by GenePeer
revived_charly wrote:The question for 002 could be rephrased as: find the sum of the even-valued terms whose sum (that is the total sum of the even valued terms) is less than or equal to 4mil. The even-valued term refers to the terms in the sequence that are even numbers e.g 2,8 and 34 are the even-valued terms from the 10 term sequence.
Not really, the sum can be greater than 4 million but the terms can not.