Skip to content

Problem 1

October 31, 2009

When I looked to the Project Euler website, I was very excited with the problems, so I decided to join and try to solve as much as I can. Since I enjoy Haskell very much, I decided to try to solve them all with it.

The first problem is an easy one, in my opinion. Here you can see the problem description.

Since Haskell has a powerful list type, I took advantage of that and here it is my one-line solution for this problem:

f = foldr (+) 0 [a | a <- [1..1000], mod a 3 == 0 || mod a 5 == 0]

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: