The passion that is Project Euler

Recently, I was made aware of a website called Project Euler through a friend. One of his status updates on a popular social networking site showed a screen shot of his progress. Having spent a considerable amount of time in Switzerland and Swiss schools as a child, the name Euler was quite familiar to me. I decided to click on the link on his status update, something that I rarely do. I did not regret it.

project_euler

See, Project Euler is a website that allows you to work on various algorithmic problems and track your progress. You can use any programming language that you want, since the answers to the problems are always a single number that you type in a text box. If you have the patience, you could actually solve some of the problems with paper and pencil, which is great.

 

I was quite impressed when I realized that a total of 369 problems were available for people to work on. On my train ride back from work (I regularly commute between San Jose and San Francisco), I decided to give it a shot. In a span of half an hour, I solved 3 problems and I was hooked. It was a Friday, and the weekend was spent on Project Euler problems. It was great fun, but I started to wonder why these problems are so exciting to work on.

 

I’m sure that everybody has their own reasons. For me personally, I believe that the most exciting part of it is that I get to work on very isolated problems. When writing code for work, the most important thing to keep in mind is usually security, followed by modularity/reusability, maintainability etc. With the Project Euler problems however, it is okay to solve just the problem at hand. If I need to operate on an array of size 100, I know that it will always be of size 100 simply because I write all the code from scratch for every single problem. It makes coding fun, and when I’m back to writing safe, reusable and maintainable code, I feel less bored.

 

Working on these problems has obviously many more benefits to us Software Development Engineers than just the fact that it gives us a nice way to unwind: One night I was working on a problem that required me to scan and format a long string of ASCII characters. Since I had become a bit rusty with the string formatters for scanf(), I decided to invest the time and read up on them before solving the problem. The most exciting thing happened the next day at work however: I had to write a routine that could scan a bunch of text using scanf()! Smile

 

I’m wondering: Are you familiar with Project Euler? If yes, do you consider yourself passionate about solving the problems? What are your reasons for liking/disliking Project Euler? Are there any other websites like this that you’re aware of?

 

I’d be curious to read your thoughts in the comments section!

7 Responses to The passion that is Project Euler

  1. Alex M says:

    Hi Stephen! Glad you’re passionate about Project Euler, it’s very addictive! I don’t know the secret behind this, but you can definitely learn a lot from it. I usually attempt the easier programs in languages with which I am not yet very confident such as Python and Haskell and leave the harder ones for Java and C++, sometimes C#. And it works amazing, my problem solving and programming skills are stronger than ever and this is after only 31/371 problems 🙂

    Unfortunately I haven’t heard of similar websites. Euler is good enough at the moment for me.

    • Stephen Pohl says:

      Hi Alex! Great to hear from you. I agree, it is a great resource to improve problem solving skills. I can tell from your blog that you’re slightly addicted too. That’s awesome! 🙂

      I have to admit that so far I’ve focused on C/C++ and pencil/paper only to solve the problems. Ultimately, I’d love to go back and solve some of the problems in Python. The forums seem to be full of very elegant solutions in Python and it made me curious.

      Have you heard of TopCoder before? I like the algorithm problems there too, but it’s unfortunate that you have to write your code in their Java applet. That’s why I’m mostly on Project Euler these days.

  2. Alex M says:

    Yes, I’ve heard of TopCoder, but I didn’t really check it that much. I’m happy with Project Euler at the moment, but it’s good to know alternatives! 😀

    I think that the programming languages you use aren’t very important in the long run. Even the pen/paper approach is very valuable. After all, problem solving skills are language-agnostic and it probably doesn’t really matter how you get there.

    And you’re right, some Python solutions are amazing! 😉

  3. Alex M says:

    Hey Stephen! In case you’re still interested in Project Euler, you might like Problem 357 (http://projecteuler.net/problem=357). Very beautiful, yet very challenging at the same time!

    • Stephen Pohl says:

      Hey Alex,

      Thanks for the heads up! A tip like this was exactly what I needed. I was busy releasing our latest Flash Player, but I kept wanting to go back to PE to unwind a bit. Now that Flash Player 11.2 has shipped, I’ll definitely look into problem 357! Thanks!

  4. Marcin says:

    It took me 3 days (working on and off) to solve the first 3 PE problems. 🙁

    • Stephen Pohl says:

      Hi Marcin,

      I found that the beginning is quite hard as well. However, I noticed that my problem solving speed improved dramatically after solving a few of them. Ultimately, I like how much you can learn by solving these problems and the time spent on it has become a bit secondary now.

      -Stephen