Mike Conigliaro

Project Euler

I’ve been working on Project Euler problems in my spare time for the last few weeks. I don’t really know what a “good” score is, but here’s my ranking so far:

I think one of the reasons these problems are so much fun to solve is because no single algorithm is necessarily more “correct” than any other (assuming you get the correct answer at the end). Consequently, there are widely varying philosophies when it comes to how they should be solved. Some people go for the most efficient algorithms, using all kinds of arcane bit-shifting tricks in low-level languages like C and assembly. Other people are only concerned with programmer productivity, opting for simple brute-force solutions that may take several hours to finish.

My personal goal has been to come up with elegant and reasonably efficient algorithms in as few lines as possible. Nice looking code almost always wins out over efficiency for me, but if my solution takes more than 30 seconds to finish, then I know I have some serious optimization to do. For a non-math guy, I think I’ve been doing pretty well so far, considering that most of my solutions finish in a fraction of a second, and the average across all my solutions is currently less than 3 seconds.

Which brings me to my next point. As a person who went through school absolutely dreading my next math class, I find it kind of amazing that I’ve been willing to spend hours solving these problems in my spare time. This tells me that there’s something seriously wrong with the way math is currently being taught. I suspect Bret Victor is on to something when he says “math needs a new interface.”

blog comments powered by Disqus