Skip to content

Problem 13

November 21, 2009

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)

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: