Solving 200 Project Euler Problems

Posted by Cameron Davidson-Pilon at


Last week, I achieved a goal of hitting 200 problems solved in Project Euler. If you are unfamiliar with Project Euler, it's a website where users can solve tricky problems that require both mathematics and programming to solve. An example question:

Having three black objects B and one white object W they can be grouped in 7 ways like this:
(BBBW) (B,BBW) (B,B,BW) (B,B,B,W)
In how many ways can sixty black objects B and forty white objects W be thus grouped?
This a) can't be done by simple for loops (hence needs math to find shortcuts) and b) has no closed for formula (hence needs programming to run computations).
In this blog post, I'll talk about my experience solving 200 problems. 

What did I learn?

Looking back, it's really impressive the amount of new things I learned. I don't have either a number theory background or computer science background, so a lot of topics were novel to me (too many to list!). Some of the topics I really enjoyed learning about were generating functions, heaps, Pell's equation, factoring combinations, and dynamic programming. My favourite problems were probability problems (my background) and dynamic programming.
I did everything in Python, and feel like a much stronger Python developer. I'm pretty sure I used each function in `itertools` at least once, and thought a lot about efficient implementations in Python. 


I started in Jan. 2016, and was able to collect my progress of completion over time:


There is also the concept of the the "difficulty" of a problem, provided by the website itself as a measure of how often participants get the answer wrong. Here is the cumulative difficulty:



I'm not finished with Project Euler yet - there are way to many problems I spent time on but didn't solve and they are just itching me. However, I am taking a break for a while so I can focus on some other projects. After all, solving 200 problems was technically my lifetime goal. 

If a person asked me "is Project Euler worth the time?" - I wouldn't immediately say yes. You do need lots of time, and it really is a personal thing (there is a leaderboard, but it's not nearly as public as, say, StackOverflow's leaderboards). You also need to think about the opportunity cost - will solving these problems further your career or research? Personally, I feel that Project Euler rounded out my understanding of computer science and mathematics, and not so heavily loaded on statistics and Python applied to statistics. 


Related Posts

Latest Data Science screencasts available

  • Good job, Cam! That’s quite the feat.

    Michael Campagnaro on
  • The link for Project Euler should go to a .net, not a .com, I got a warning when going to the .com

    C on

Leave a comment

Please note: comments will be approved before they are published