Problem 13
For the 13th problem of the Euler project, I started by defining a list containing the one hundred numbers. So, it would be something like:
import Char
l = [37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538, ...
53503534226472524250874054075591789781264330331690]
Then, it was a matter of defining a small function that would return the first 10 digits of the sum of all those numbers:
sumF :: [Integer] -> [Char]
sumF = take 10 . show . sum
The result (of executing sumF l) was achieved using the following timing/memory resources: (0.01 secs, 5340404 bytes)
blog comments powered by Disqus