P

#### Panagiotis Atmatzidis

Hash: SHA1

Dear Sirs,

Just to improve my programming skills and experience I found amusing =

solving problems like the ones posed by project Euler. Doing so, using =

Ruby is a joy, compared to Objective-C that I've used for the same =

purpose in the past.

I'm stuck in the second problem though. Here is the issue:

Each new term in the Fibonacci sequence is generated by adding the =

previous two terms. By starting with 1 and 2, the first 10 terms will =

be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

Find the sum of all the even-valued terms in the sequence which do not =

exceed four million.

I think that my code solves it. Works when I test it to smaller =

fractions, can someone reply if there's something wrong with this =

snippet:

- ---------------

# fibonacci

a =3D 1

b =3D 0

sum =3D 0

while a <=3D 4000000

# get the old value of "a"

c =3D a + b

#puts c

if (c % 2 !=3D 0)

sum =3D sum + c

end

b =3D a

a =3D c

end

=20

puts sum

- ---------------

Well my result is: 10316618 . I know that the original Fibonacci =

sequence will have a (+1) in the beginning of the loop, but (probably) =

for the sake of convenience is ignored. The system however returns a =

"false error" in both 10316618 and 10316618 + 1.

Thanks in advanced & best regards=20

Panagiotis (atmosx) Atmatzidis

email: (e-mail address removed)

URL: http://www.convalesco.org

GnuPG ID: 0xFC4E8BB4=20

gpg --keyserver x-hkp://pgp.mit.edu --recv-keys 0xFC4E8BB4

- --

The wise man said: "Never argue with an idiot. They bring you down to =

their level and beat you with experience."

-----BEGIN PGP SIGNATURE-----

Version: GnuPG/MacGPG2 v2.0.12 (Darwin)

iEYEARECAAYFAksr3P4ACgkQrghUb/xOi7Sj3ACfRTXLtHk9vhUuPJ9Ul2o2jlor

mLkAoJGFCERzUJsXjdrnNeYAhXAqn2wf

=3Dv8zV

-----END PGP SIGNATURE-----