## Problem 002

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
harryh
Posts: 2091
Joined: Tue Aug 22, 2006 8:33 pm
Location: Thessaloniki, Greece

### Re: Problem 002

@phillyj : Please don't start a new thread (topic) if one already exists for the same problem.

antonwahyu
Posts: 1
Joined: Wed Oct 20, 2010 10:49 am

### Re: Problem 002

hi guys,
in this case, "Find the sum of all the even-valued terms in the sequence which do not exceed four million"
i am not understand about this sentence.. somebody can translate for me...i put my answer and the result is wrong, maybe i not yet understand about the question. so what the mean about the question. for example if 4 million change to 10. what the result? is it to be 1,2,3,5,8 right? and the answer is 8? or 1+2+3+4+5+8 = 23? any body help me? thanks before

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 002

if you change 4 million to 10 the answer would be 2+8=10.
Why? 2 and 8 are the fibonnacci numbers less than 10 that are even. (an even number is a number that is divisible by 2).

cobrophy
Posts: 1
Joined: Thu Dec 23, 2010 3:50 pm

### Re: Problem 002

Hi,

I spent a while getting this wrong because I misunderstood the problem statement:
Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
I incorrectly thought the not exceeding 4 million referred to the sum rather than the even-valued terms.

It might be a little clearer if the problem was phrased as:
Find the sum of all the even-valued terms under four million in the Fibonacci sequence.

euler
Posts: 3069
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

### Re: Problem 002

This has been addressed before. Contrast the following two sentences.

Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
Find the sum of all the even-valued terms in the Fibonacci sequence which does not exceed four million.

The antecedent to "which" is identified by the use of the verb: "which do" refers to the terms (plural); "which does" refers to the sum (singular).

However, given the regularity to which this is creating confusion - and it's not like we're trying to test subtle use of grammar - so I'll change it to the following...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

impudens simia et macrologus profundus fabulae

sunde887
Posts: 1
Joined: Wed Jan 05, 2011 3:08 am

### Re: Problem 002

edit: figured it out.
Last edited by sunde887 on Wed Jan 05, 2011 9:48 pm, edited 1 time in total.

rayfil
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Contact:

### Re: Problem 002

(I hope this isn't a spoiler, I apologize if it is)
Regardless if posted results are correct or not, the opening message is clear, i.e. don't post any code or results.
When you assume something, you risk being wrong half the time.

wygk123
Posts: 3
Joined: Wed Feb 09, 2011 2:10 pm

### Re: Problem 002

The Java solution:

code snipped by hk
}

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 002

This forum is not meant to post solutions. Please remove it.

arnaud.nauwynck
Posts: 2
Joined: Thu May 19, 2011 8:27 pm

### Re: Problem 002

Hi,

I am new to this site, and I have just done problem 002.
I have done it 2 ways...
1) the hard way (pure math + simple calculator), and I have found an algebraic formula for the answer
2) and then using a small algorithm with few lines of code... mainly for checking.

After I have submitted my result, I have read many comments on the solution (the official pdf, then posts among the 250 ones), but I was disapointed by the official solution shown, and the solution forum is closed ...
Is there an administrator to re-open it, or someone wanting my closed-formula solution by email ?
I understand that its written not to deliver the solution in public forums, so I don't write it here...

Sincerely,

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 002

You can PM your solution to me as I wrote the pdf.

arnaud.nauwynck
Posts: 2
Joined: Thu May 19, 2011 8:27 pm

### Re: Problem 002

did you received the email ?

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 002

I did. I will investigate it and send you a reply.

rjgonza
Posts: 2
Joined: Fri Jun 10, 2011 10:22 pm

### Re: Problem 002

I am having a little trouble with this one. I think I may be interpreting the question incorrectly. The value in question is the actual terms of the sequence, not the corresponding position in the sequence correct? If that is the case then I am not sure why my code is not working. Would I be able to pm it to someone to give it a quick glance?

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

### Re: Problem 002

Sure.

243009558he
Posts: 2
Joined: Tue Jul 19, 2011 1:14 pm

### Re: Problem 002

Code snipped by hk.

stoop65
Posts: 1
Joined: Sat Jul 30, 2011 11:32 am

### Problem 002

Hi Euler Team,
Regarding problem two, the Fibonacci sequence starts like this:

F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10
0 1 1 2 3 5 8 13 21 34 55..., *

but the problem outline starts with the terms 1 and 2 (F2 and F3). This would change the solution.
Where should I start? Semantics, I know, but problem 1 caught me out with semantics ("...3 OR 5...").

Thanks in advance for a clarification,

Steve.

* (Thank you Wikipedia: http://en.wikipedia.org/wiki/Fibonacci_ ... ci_numbers )

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 002

The answer is NOT affected as you are asked for the sum of the even-valued terms.

Duffmancool
Posts: 1
Joined: Tue Jul 16, 2013 5:53 am

### Problem 2: Even Fibonacci numbers

There is an error on the problem description.

The Fibonacci sequence does not go: 1,2,3,5,...
It goes: 0,1,1,2,3,5,...
Or maybe even: 1,1,2,3,5,...

http://en.wikipedia.org/wiki/Fibonacci_number
http://en.wikipedia.org/wiki/File:FibonacciBlocks.svg

hk
Posts: 10422
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 2: Even Fibonacci numbers

Or even:
1,0,1,1,2,3
Or
-1,1,0,1,1,2,3
Or
2,-1,0,1,1,2,3

So I'm not sure what you try to tell us.