Problem 8
The 8th problem in the project_euler website didn’t offer a lot of resistance. I started by defining the 1000-digit number in Haskell, naming it n. So, I had something like:
(I didn’t see the point of writing the entire number here, since it is very big). Afterwards, it was a matter of defining this simple function:
Where g is defined as:
One could argue that it could be more efficient, however my ghci calculates the following execution time: (0.03 secs, 1834872 bytes)
blog comments powered by Disqus