Sunday, December 19, 2010

Project Euler

As mentioned in the previous post, I've started working on Project Euler. I've just completed the first 50 puzzles, so I thought I'd share my solutions here.

My language of choice was Python, for a couple of reasons. First, I'm still trying to teach it to myself, so implementing several small programs is a good way to do that. Second, Python natively supports arbitrary-precision integers, which is necessary for some of the programs in Project Euler. Lastly, since it is a scripting language it allows a rapid development cycle.

So far, I've been able to stick to the additional constraint of keeping the runtime of my programs under a minute. Many of these programs have an obvious brute-force solution, but the more elegant, faster solution (that takes under a minute) is a bit more elusive.

Since Blogger apparently doesn't allow attachments in blog posts, here is the URL for my solutions:
http://cseweb.ucsd.edu/~mstepp/euler/projecteuler.1-50.zip

There are currently over 300 programs in Project Euler, and I hope to eventually finish them all, but a man can only procrastinate so much in a given week.

No comments:

Post a Comment