Project Euler

November 10th, 2008

I came across this interesting project online. It’s called Project Euler, and the point is to use both mathematical skills and programming skills to solve the posted problems. You can use whatever language to solve, and you input the answer to validate it. So far I’ve worked on the very first one, and it’s pretty fun, both from a programming perspective, and from a math geek POV.

Here’s my solution to Problem 1:

Problem: Add all the natural numbers below one thousand that are multiples of 3 or 5.

Solution (Python):
reduce(lambda x,y: x+y, ifilter(lambda x: x%3==0 or x%5==0, range(1,1000)))

:)

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click on the image to regenerate some new text.

Anti-Spam Image