Tag Archives: fibonacci

Euler Problem 104 – Hello Fibonacci

Fibonacci sequences are the “Hello World” of Haskell. So of course I thought that Euler 104 might be a nice, simple problem to tackle. NOT. I found lots of examples online, but I still have a steep learning curve to follow. I ended up piecing together a bunch of disconnected routines that make sense to me.

The only reason why this runs in less than a minute is due to Haskell’s laziness. Specifically, the second expression for the && isn’t executed unless the first passes. Calculating the lower order numbers is much faster than the higher order numbers.