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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
harryh
Posts: 2091
Joined: Tue Aug 22, 2006 8:33 pm
Location: Thessaloniki, Greece

Re: Problem 002

Post by harryh » Sat Oct 16, 2010 7:10 am

@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

Post by antonwahyu » Sun Oct 24, 2010 11:00 am

hi guys,
sorry i still not understand about this sentence, maybe can translate to me to Indonesian?
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

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 002

Post by hk » Sun Oct 24, 2010 11:05 am

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).
Image

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

Re: Problem 002

Post by cobrophy » Thu Dec 23, 2010 3:54 pm

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.

User avatar
euler
Administrator
Posts: 3047
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 002

Post by euler » Fri Dec 24, 2010 9:00 am

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.
Image
impudens simia et macrologus profundus fabulae

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

Re: Problem 002

Post by sunde887 » Wed Jan 05, 2011 3:12 am

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

User avatar
rayfil
Administrator
Posts: 1401
Joined: Sun Mar 26, 2006 4:30 am
Location: Ontario, Canada
Contact:

Re: Problem 002

Post by rayfil » Wed Jan 05, 2011 5:40 pm

(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

Post by wygk123 » Wed Feb 09, 2011 2:46 pm

The Java solution:

code snipped by hk
}

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 002

Post by hk » Wed Feb 09, 2011 3:06 pm

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

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

Re: Problem 002

Post by arnaud.nauwynck » Thu May 19, 2011 8:56 pm

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,

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 002

Post by hk » Thu May 19, 2011 9:04 pm

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

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

Re: Problem 002

Post by arnaud.nauwynck » Thu May 19, 2011 10:33 pm

did you received the email ?

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 002

Post by hk » Fri May 20, 2011 8:01 am

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

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

Re: Problem 002

Post by rjgonza » Mon Jun 13, 2011 11:11 pm

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

Post by TripleM » Tue Jun 14, 2011 1:31 am

Sure.

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

Re: Problem 002

Post by 243009558he » Tue Jul 19, 2011 1:19 pm

Code snipped by hk.

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

Problem 002

Post by stoop65 » Sat Jul 30, 2011 12:07 pm

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 )

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 002

Post by hk » Sat Jul 30, 2011 12:33 pm

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

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

Problem 2: Even Fibonacci numbers

Post by Duffmancool » Tue Jul 16, 2013 5:59 am

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

User avatar
hk
Administrator
Posts: 10316
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Problem 2: Even Fibonacci numbers

Post by hk » Tue Jul 16, 2013 8:17 am

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.
Image

Post Reply