Posted by

kabutz on February 24, 2012 at 11:44 AM PST

Try find the billionth fibonacci number. The answer should be in hexadecimal, and to prove that you have the whole number, you need to post the first 10 bytes and the last 10 bytes. I solved it in 2500 seconds on an 8-core machine. Winner will get special mention.

We all know the standard Fibonacci recursive algorithm:

` public BigInteger f(int n) {`

if (n == 0) return BigInteger.ZERO;

if (n == 1) return BigInteger.ONE;

return f(n - 1).add(f(n - 2));

}

Your challenge is to find the first 10 bytes and the last 10 bytes of f(1_000_000_000). That's right, fibonacci of one billion. Please post the answer here, in hexadecimal.

My solution took 2500 seconds on an 8-core machine, utilizing all the cores.

Winner will get a special mention in my next Java Specialists' Newsletter (http://www.javaspecialists.eu ).

One last hint. Fork/Join is very useful to speed up your calculation.