/projecteuler-solutions

Numerical answers to all 600+ Project Euler problems

Warning - This site contains spoilers. Please close this page immediately if you wish to solve the problems yourself.

What is Project Euler?

Project Euler (projecteuler.net) is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

What is projecteuler-solutions?

As the name suggests, projecteuler-solutions is a collection of solutions for site Project Euler. This site aims to provide complete and accurate solution listings for Project Euler.

What is the purpose of this site?

After you struggle for hours or days on a difficult problem, you may eventually give up (after all, the world would be a strange place if people never gave up on a problem). At this point, you have two options:

  • Without a solution, you leave feeling frustrated; you feel as if all your effort had been for nothing. With no way to check the right answer, you don't know how close you were to the solution or where you had gone wrong. If the solution required advanced techniques unfamiliar to you, you would have had no way of knowing. In the end, you have learned nothing, leaving without even the gratification of having figured out the problem.

  • With a solution, you can compare your method with the correct solution, perhaps figure out what you did wrong. Alternatively, you can peek at the solution as a sort of 'hint' -- that is, knowing the solver's general approach, figure out the details of his solution, then code the solution yourself. Either way, you have gained from this problem -- as much as you would have gained had you solved the problem completely independently.

In the end, the purpose of Project Euler isn't to compete for rankings. The main purpose of the activity is to learn and improve yourself in a challenging and fun way. If you need to 'cheat' in order to learn from and enjoy the problems, so be it.

Where are the solutions / How do I use this site?

Projecteuler-solutions provides merely a list of answers -- that is, it does not provide solutions or code for individual problems. The link to the list of answers can be found at the top of this page.

With the numerical answers, you have access to the official forums, in which you can access dozens of solutions in numerous different programming languages, often using several very different approaches. By unlocking this valuable resource for you, Projecteuler-solutions hopes that you will be able to get more out of Project Euler.

For a thorough exposition of solutions, I recommend Project Nayuki, which solves about 200 of the problems using Java, Python, Mathematica, and Haskell.

What about cheating?

Of course, it is possible for one to mindlessly copy and paste solutions one by one into Project Euler to gain ranks. Obviously, this is quite pointless, as Project Euler ranks can gain you nothing in the real world. Your account is likely to get banned, and you are only cheating yourself of mathematical learning.

An answer is missing / incorrect!

If you have the answer to a problem whose answer we do not yet have, or notice that an existing answer is incorrect, we would love to hear from you! Either create an issue on this repository, or email me at luckytoilet@gmail.com. I will verify the answer and update the solutions as soon as possible.