4 reasons to try Project Euler

I recently discovered Project Euler and have become an overnight evangelist. For those of you unlucky enough to not have discovered it yet, Project Euler (pronounced “Oy-ler”, by the way) is a series of maths problems that lend themselves to being solved with programming.

In my humble opinion, Project Euler is great. So great, in fact, that I thought I’d spell out exactly why you should give it a try. So here goes, 4 reasons I think you should give it a go.

Portrait of Leonhard Euler

Leonhard Euler, the mathematician, logician, and engineer, for whom the Euler Project is named.

1. Problem solving

A key “soft skill” in professional software development is problem solving. I define this as assessing and understanding a problem, in order to apply experience, to reach a solution. Project Euler is a very long list of problems to understand and solve. The problem definitions require careful comprehension and contain very few clues as to how they should be approached. Practicing to solve the problems contained within Project Euler will make you better at solving problems at work – I guarantee it.

2. Rediscover maths

Lots of developers I speak to say that they enjoyed maths at school. There’s something about the way in which maths makes you think that can be very satisfying. Perhaps its the purity of the way numbers fit together? Anyway, maths is at the heart of Project Euler. You’ll be forced to dust off old memories of prime numbers, factorisation, and Pythagoras – and that’s just the first 10 problems!

The thing about maths is that it doesn’t exist in a vacuum. I don’t mean that prime numbers are necessarily that relevant to your line-of-business enterprise development project, but the skills involved in solving maths problems are enormously transferable. It’s not so much the answers that are important here, but the numerical reasoning that you’ll need in order to reach them.

3. Performance

If you’ve assessed the problem correctly and can remember the appropriate maths from school, there’s a really good chance you’ll be able to work out the right answer eventually. The question is, can you write a program that can find the answer in under 60 seconds? Project Euler have a guideline that all problems are solvable in under a minute of computation:

Each problem has been designed according to a “one-minute rule”, which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.

So, whilst you could brute force your solution, there’s always a more “performant” approach. Part of the fun of Project Euler is trying to work out the elegant way to reach the correct answer. If you’re like me, this is hugely appealing. More importantly for your career, learning techniques for making code more efficient will make you a better programmer.

4. Fun

This is an important one: Project Euler is fun.

I’m betting your employer won’t let you work on solutions to Project Euler problems on their dime, so you’re going to have to do this in your spare time. I’m a busy guy. As well as being a full-time software developer, I’m a father, dog owner, and house restorer. My spare time is precious, so I spend it carefully. The good news is, Project Euler is a lot of fun and actually pretty addictive.

My Project Euler journey

So far I’ve solved the first 10 problems. If you’re so inclined, you can follow my progress. My plan is to work through them in order at first, whenever I get a good chunk of time to attack them without interruption.

I won’t be sharing my solutions on this blog, because it undermines the whole point. From the about page:

Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery.

On the other hand, if I find a particular problem / solution interesting, I may post something about the general principle. If I do, I’ll be careful not to give too much away.

Leave a Reply