Project Euler

Project EulerI picked up a tip for a cool website from one of the podcasts I’m a regular listener of. Think it was DotNetRocks! but I’m not absolutely sure. [Edit: It was DNR #428 with Mike Nash talking about Windows 7 and IE8] The tip was brought in by some guy who was trying out F#. On learning the syntax of a new language, he would try and solve a set of math-problems in the new language to get a feel for how it works. He referred to a site known as Project Euler which hosts a collection of math-problems of varying difficulty.

One can register for an account at the site, and once you have solved a particular problem, you send in the answer. If it’s approved, you’re allowed access to a forum thread discussing this particular problem and showcasing the different approaches and programming languages people have used to solve that problem.

I was so intrigued by this that I jumped on it first chance I got! By bed-time last night, I had solved the first two problems, and used some of the suggestions in the forum thread to tweak my C#-code. It was very interesting to see how the problems were solved, both using higher maths (far beyond me! :)) and as I did, brute-forcing… There are some *very* obscure languages out there! 🙂

I was also able to use suggestions in the forum to time the execution of my code, and to my surprise, the ~1000 iterations in the first problem were computed in less than 1ms in my ASP.NET C# code! I was impressed! There was some guy in the forum that touted how his code solved the problem in “only” 274ms, so I was very impressed that my less-than-optimal C# snippet was that much faster! Granted, his solution was done waay back in 2005, so maybe computers really have gotten faster since then.. 🙂

All in all, Project Euler is a very interesting site I’ll be sure to visit every time I feel up to a challenge. It’s gonna be a *very* long time until I’ve solved all 240 problems, that’s for sure!!