12 years ago I was a failed computer science student, wasting my time on drugs. Having failed so many classes I did not see any future at all, and I was considering killing myself to get out of the anxiety and stress.
My confidence regarding programming etc was 0.
I decided to apply for a junior developer job. I got an interview and to prepare for an interview I found this site, Project Euler. I did ten or so tasks.
The interview started out pretty bad, they asked me some technical questions which I did not give good answers to, and I saw that they where not impressed. Then they wanted me to solve two programming problems on a white board. Imagine the relief I felt when both of these questions where from the ones that I solved on Project Euler a couple of days before! I nailed them and the interviewers where clearly impressed. In the end they hired me and motivated it with that although I lack a lot of theory I am obviously a very good coder haha.
Anyway, that was what I needed, when I got this job I quit the drugs and got my act together. 12 years later I live a confortable life as a freelancer and have even managed to build my own SaaS with paying customers! Thank you Project Euler.
Good for you! Inspiring stories like yours are positive externalities that will no longer be extant in the same way when everyone’s minds are just thin clients on top of LLMs!
Great story. Are you willing to share more about your SaaS?
I'd love to but I can't be too specific due to the personal stuff I shared in the original comment.
It's a system that helps services companies within a certain industry to digitalize all their paperwork, report to the national goverment agencies etc. They do a lot of manual work which can be digitalized easily.
I found this opportunity by just randomly throwing out in a big community that I build software and is looking for ideas, and some guy answered that ended up being my business partner for 3 years now. We are not rich from it but earn like $2000 each a month after tax which is quite a lot for us since we live in a country where healthcare, schools, parental leave etc are covered by taxes. And we dont need to put more than a few hours a month on support. I have put in basically all my spare time for 2 years to get to this point though, the biggest reward is not the money but the process of sitting through the nights being completely in the zone and building this stuff knowing that it will be great :D
No problem, what you have shared here is very insightful. Cheers to continued success and evenings in the zone.
I'm so happy to have spent twenty years of my life learning math and solving problems on Project Euler and elsewhere.
This is one of my favourite problems, I still remember that it has a very real edge case even though I solved it more than 10 years ago. Thank you for the problem!
I'm guessing if you only calculate based on the digits, the probability is going to be slightly different than the real one, because you only have a finite number of plates you can choose from.
Sounds like the birthday paradox problem. Is it?
Nearly, but not 8 digits of precision worth.
I'm glad you enjoyed! It was a real game I played when driving around.
Can you reuse a plate with 500?
The wording seems to strongly imply no; you need two separate plates with 500 on them.
That sounds like a combinatorial problem...alphabets from AAA to ZZZ, numbers from 000 to 999.
That means one of the total sum of possible car plates is 26^3.
Since we want to find pairs (x, y) that x + y = 1000. That means the total sum would also add up sum([1 for x in range(1000) for y in range(1000) if x + y == 1000])/2 since there is a symmetry.
But wait, find the expected number of plates he needs to see for a win. So maybe we need to borrow something from statistics (Possion/chi-squared distribution) or queueing theory...?
Edit: ah I saw the solution, it is a Markov chain.
[deleted]
Interesting- I ask a license plate question (when will california run out of plates in its current serialization format, based on a couple of plates observed in two different years). It's a much simpler question, though (just linear extrapolation).
I got an email six years later (in November 2024) telling me they accepted the problem:
Greetings!
Please excuse the email. It's quite possible that you are no longer active at Project Euler, but we are currently trying to retrospectively acknowledge contributors of problems.
You were identified as being involved with Square subsets [619 m] in Sep-17.
If you would like to be added as a verified contributor, please reply to this email and provide the username you currently use at projecteuler.net. Please note that contributor usernames will not appear publicly, rather they will be used internally to unlock new contributor awards we are introducing.
Regards,
Project Euler Team
I was curious if LLMs are good for this problem. ChatGPT-5.1-Thinking one-shotted a correct Python script without any library use (https://pastecode.io/s/jg6ggxpm).
Claude Opus failed to solve after trying for a while.
project euler problems are likely in the RL corpora
First of all, don't do this. No one cares. Secondly obviously every Euler solution is going to appear in the training data many times over. It's no surprise at all that an LLM can regurgitate data that was given to it.
I do care. I appreciate /u/webo's comment. If you're a hater, don't generalize to others. There are still people out there embracing new technologies and change, and with an intact engineering spirit driven by sheer curiosity.
I thought it was interesting, and I wouldn't be surprised if Euler solutions weren't in the training data, especially for the later problems like this one.
I appreciate you trying it! So at least I care.
I used to do these in college to procrastinate my homework. I always had the most difficulty with the problems that required data structures I wasn't exposed to previously and ended up making really complicated solutions that were inefficient as hell, but fun nonetheless.
I might give them a try with golang now that it's my preferred language. I used to do them in python as that was our intro language.
Perhaps you meant to reply to webo? I'm not sure what you think I might have been trying.
Were you also one of Dr. Kedlaya’s students? Or just used that link? I was in an undergrad course of his and really enjoyed it. Such a smart guy.
Ha! I did a lot of these around 2007-2008. I solved the first 100 or so ones. Solving these were more fun than any other programming problems site I've seen. I quit it when I realized I was spending 4+ hours per problem - I couldn't justify the time.
Beyond a certain point, most required some knowledge of elementary number theory.
Same for me, the first 100 are doable, after that they take more and more time and require deeper mathematical knowledge. Which is nice as well, but at some point I started to wonder if it wouldn't be better if I spent all that time on learning some more practical knowledge.
Same timeline for me! This was my great procrastination side quest during grad school. I learned haskell and a bit of ocaml working on these. Functional languages are extremely well suited to these kinds of problems.
I agree with you. About a decade ago, I got really tired of coding interview prep. I somehow ended up getting into Project Euler and worked through the first 100 problems. It was a great way to learn a bit of number theory and regain my interest in programming.
This website was a part of my education as a computer scientist and seeing it here again I'm curious for the full story of how this site was made. Who made it, what do they do now, is it part of a broader project they have?
This article is excellent. It mentions the creator, Colin Hughes, and the story behind the project, but it boils down to a passion project for him.
Back in early 2000s, before hackerrank and similar coding sites, this is what my professors recommended for training programming skills.
Yeah my HS CS teacher recommended it but I don't think it was ever required
The most fun on this site is solving a problem and then having your mind blown by solutions in Apl/j/k and trying to guess what they mean without knowing anything about those languages
I've solved about a hundred PE problems in Livecode, maybe 40 in Python, and about 20 in J. I highly recommend giving it a try in a language you don't know, it's fun! Especially with something as obscure as J.
Even better than the crazy languages, is seeing some fundamental math used to prevent having to do a ridiculously expensive search.
That said, raw brute force often did far better than you'd like to admit.
The biggest thing I learned from PE was that neither elegant theory nor brute force had a monopoly on successful optimization strategies. It's been something I've carried with me ever since and has over and over again proven its value.
A real gem of a resource.
See also Uiua, a newcomer to the "extremely cool but completely incomprehensible language" family!
What's really neat is that most of the problems are so compact that you can just read about the full problem, then spend hours and days thinking about possible solutions.
I have done Project Euler very sporadically since high school. To date I've only done problems 1-54. Despite this, I think the website was a big contributor to my love of programming. I found it before knowing about leetcode and I think it prepared me well. I think I owe Project Euler a decent %-age of my eventual entry into Software Engineering as a field.
Ditto!
Also a great way to learn a new programming language is to try project Euler problems with it.
These are both a lot more fun, and a lot more educational than leetcode problems. Strongly recommend for anyone looking for practice problems when learning a new language or whatever.
I thank project Euler because whenever I face some coding challenge that has any mathematical inclination, I will(!) impress interviewers.
I spent a lot of time on it, and learned a considerable amount of theory and hacks. What a privilege to be able to do this, instead of digging the fields and other manual labor.
Thanks culture!
There is a somewhat similar idea behind "Ponder This" by IBM
https://research.ibm.com/haifa/ponderthis/index.shtml
They post a problem every month and in the end post a solution.
I used to spend a bit too much time on those.
The difference is that Ponder This is harder than the average problems in Euler Project, and requires higher level of mathematical maturity.
One of my best memories was in undergrad there was one semester in 2013 where half a dozen of my CS classmates and I competed to try and solve the most Project Euler problems. We had a leaderboard and everything.
I saw first hand how much faster my friend’s Java solutions were than my Python solutions.
Good times.
No one tells you that they delete inactive accounts. I used to have over 300 solved problems htere. Now it is all gone, all the effort, but the skill remained of course.
A few years back (10 maybe?) they had a disk crash, and there was a notice that for people with 100 or more problems solved they'd do an extra effort to recover their solutions and add you back, not sure if it was only posted on the main website. I was lucky to get my account back at the time
Ah okay, I was active there 9-12 years ago, so it migh been before the crash. I remember checking it, however, 7 years ago, and I was still able to log in.
So, I gather that you treated your solutions as throw-away code, rather than keeping them? Kind of surprising, considering that some problems build off of each other, or otherwise benefit from sharing code; you never know when the code for one solution could be useful later. For example, a prime number generator/tester is necessary for many of the problems.
(I have all my solution code, in source control no less, so if I ever lost my account, I could just run them all and re-enter the solutions.)
> So, I gather that you treated your solutions as throw-away code, rather than keeping them?
I kept the code that I found clever or useful, but I had a very borderline approach to archiving my stuff in general back then. I was still in high school.
I remember there were data loss, but my account appears to have been recovered. You may try to login again, and with luck, like me you will get back your history.
I still have the code for the first 50 problems in GitHub. The last commit was thirteen years ago. I don’t know why I checked these in rather than treating them as throwaway code like I did for so many other things, but I’m glad I did as I’m sure my PE account is gone now too.
How long before they start deleting? I haven't logged in for 5 years and my account is still there.
Whelp, the opening “problem zero” stuffed me up.
> A number is a perfect square, or a square number, if it is the square of a positive integer. For example, is a square number because ; it is also an odd square. The first 5 square numbers are: , and the sum of the odd squares is . Among the first 881 thousand square numbers, what is the sum of all the odd squares?
I wanted to use Uiua, and hence:
/+ⁿ2+1⍜÷⇡ 2 881000
But Uiua doesn’t support big ints, just f64. So yuck, python to get an accurate answer. Just sad now.
I ranked on that once! I was like the 23rd person to do one of the new problems one time. Just about as low as you can rank. It was a fun puzzle but you had to be awake at a funky time to do it.
I was trying to create an account but it kept saying the confirmation code was wrong. Idk if that's a bug but... I was using the audio captcha. Still, the website seems pretty neat!
During my university time, I used to do a lot of different programming puzzles and algo. I think it an invaluable training that every serious engineer should try without relaying on AI.
Skills are trained by practice and thinking. Skilled people will never be subsidized by AI. Unskilled juniors, who don't train properly will go into tranches (as it's already happening).
Project Euler spurred my love for math and programming when I was 15. I got through the first few with pencil and paper and then quickly realized I was going to need to learn how to program. Got started with Java (in Eclipse) and then moved on to Python. I feel like it completely changed the trajectory of my life.
Are there other similar sites? I remember this one, for bioinformatics
After learning AWK I realised it could be used really neatly for problem 67. I remember it was blazing fast, orders of magnitude faster than Python
Did you use the regular version or the one with multiple-precision values?
Like many others here, Project Euler was foundational in my education and growth as a programmer.
Leonhard Euler himself is an incredible figure and arguably the most prodigious contributor to mathematics throughout history. So much so that people started naming things discovered by him after the next person to have proved them.
Maybe Gauß takes that trophy. To me it felt in mathematics lectures, that Gauß had his hand in everything. Euler might have had that too, but I am not that aware maybe.
I attribute project euler for instilling the playful enjoyment of writing programs in college while I was studying electrical and computer engineering. I owe my career to it!
I think a hat-tip is due to freeCodeCamp for introducing Project Euler (along with Rosetta Code) to a new generation of programmers:
Since this is still on HN frontpage. Does anyone suggest any math books to help solve these problems. I am pretty sure you can't solve problems above 50 without strong maths background.
Concrete Mathematics is probably the best single book that you could read to prepare you for some the problems beyond the first 50. It’s extremely fun, and also mathematically serious. A large portion of PE problems are exactly in the cross sections of number theory, combinatorics, and computation that is covered in this book.
I discovered project euler as a novice programmer in high school around 15 years ago. I loved how solving a problem unlocks a secret forum only available to other solvers. I would spend hours reading through everyone's prior solutions and trying to understand them. One guy had tagged his profile as "haskell" but would always provide his solutions in ruby which threw child-me for quite a loop (I actually thought ruby and haskell were the same language for some time)!
Wow, I can't believe this is still around! I'm glad to see artifacts from the past like this are still out there on the internet.
Makes me miss Google CodeJam though.
I remember it vaguely but there used to be a badge awarded for being among the first 100 people to solve the problem. I was obsessed with getting that badge to the point that I spent obscene amount of time solving the-then recently released problem even when the following day was my final exams. I did manage to get that badge though. This was circa 2013. Fun times!
403 Forbidden
Request forbidden by administrative rules.
Note: I didn't know and open this website until now.
Well, that sucks!
Project Euler was what I used to get comfortable with my two main languages -- first python and then rust.
I loved to solve it and then look through all the different solutions and find pretty ideas and idioms.
I love running euler problems when trying to learn the basics of a new programming language. I have a small collection of programs in like 10 different languages that I keep around as a reference for things because I always try to use language-specific features to solve the problems, and then I reference them as examples.
Wow. You reminded me of a computer engineering class years ago where we wrote assemblers and emulators for a simple architecture. I tested mine by writing a solution for one of the first Project Euler questions!
I still have my Oberon-2 compiler from my compilers class and a handful of Euler questions I used to test it.
So, to remind myself, Euler's name is pronounced more like Oiler, right?
That's how I was taught, and Wikipedia agrees (and even provides audio clips alongside the IPA and English phonetic transcriptions).
I too owe had my love for programming captured through project Euler. I am immensely grateful to my maths prof who introduced me to it.
I also love looking back at my old PE code and having absolutely no idea what it doing. No comments, no docs, no notes. From a different era.
So much more fun than leetcode. OTOH, unlikely to help you in an interview.
It would help you if I were doing the interview…
[deleted]
I remember visiting Project Euler back in 2013/14 or so. Was really my first introduction to programming exercises as youngin. Probably did fifteen or so of them before ADHD kicked in though. A small gem on the web.
I did a lot of these when I was around 15-16 and it solidified for me my interest in CS but in general abstract thinking and problem solving. Great site.
i was a euler fanatic some years ago reaching problems in the 500s albeit, skipping problems along the way. at that point, too many problems required a deeper math background than i possessed so i abandoned it. what amazed me was that others composed solutions that solved problems in mere milliseconds that brute force approaches would still be running when the universe cooled to absolute zero.
I only reached the 100s back in the day. What amazed me was that it seemed like every problem had a paper solution, when it would take any computer algorithm thousands or millions of computations to solve the same problem.
I played around with some of the easier problems, my favorite was a couple times when starting with the obvious brute force solution in code and then refactoring and simplifying it iteratively ended up getting me the paper solution.
Anyone else having problems registering? or is my solution to Problem Zero wrong...
Thousand of hours on this. Love it.
very surprised this project is still releasing problems weekly - I remember this being up when I was in high school. maybe I'll pick it up again since I only did the first ~30 or so back then.
Not only are they still releasing problems weekly, they have a long backlog of problems waiting for release. I submitted a problem back in April 2024, and it didn't get published until October 2025 (problem 963). There's an excellent core development team that works with problem-submitters to get problems tuned up for Project Euler.
Anyone else having problems registering or is my solution wrong?
This is such a great site.
How I learnt about prime number sieves.
Good prep for Advent of Code in 2 weeks.
The leetcode before leetcode. Hail.
this is how you end up getting into APL/array langs for sure.
Second this ... have been writing some solutions in Kap, an APL like variant. It's stunning to see 20+ idiomatic solutions in one screen as many problems can be solved in a compact manner. The elegance really reminds one of why we fell in love with Programming in the first place
Thanks for reminding me this; I'd try to solve them both in Scheme (s9fes) and JimTCL.
2007 I remember writing one-liner ruby solutions up to 100.
Hackerrank also used to host(still has?) PE problems with additional test cases.
Glanced at the exercises. It appears that two of them have numbers arranged in a triangle and ask for a longest path.
Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x. For the resulting triangle, solve it to give the shortest path using one of the well known network shortest path algorithms.
The "well known" path algorithms in this case are overkill; the graph is a tree. And Dijkstra is not really designed to handle negative edge weights (although it would probably function correctly in this instance).
> Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x.
By the time you've actually done these two steps, you could have already finished the problem with a dynamic programming approach.
(Starting from the bottom row and working upward, replace each cell in the row with the length of the longest path from itself to the bottom, which you can know by checking which of its two children has the longer path associated.)
[dead]
[flagged]
Nobody is interested in AI commentary.
That seems incorrect. This sub-thread is the longest already in this submission, and no other commenter remarked about the parent commenter being an AI.
I've personally found the opposite. In order to advance you need to know the specific techniques or mathematics and there are no hints or information on how to approach the problem. So it boils down to how much of that mathematics you know. If you don't then the brute force approaches take a long time to find the solution.
I disagree.
Often the techniques that you need for a harder problem, are discussed in a forum for an easier problem. Even more often the techniques that you need for a given problem are possible to work out from scratch. And the more you work out, the easier they get.
This can be very frustrating for people who are used to being spoon fed techniques, then given problems which use what they have just been taught. But it is a lot of fun for people who enjoy puzzles. If it isn't your cup of tea, that's fine. But don't dismiss it for people who enjoy it.
Disclaimer. I haven't personally engaged in the last few years, but I've spent a lot of time on it. I solved 598 and contributed a couple of puzzles as well. One of which they immediately saw a way to do that I hadn't, and put it out there with a difficulty level that I didn't know how to do! That was https://projecteuler.net/problem=240.
Wait, the math is discussed only in the forums? I thought one is supposed to gain mathematical insight from solving alone. As far as I have read here, forums are only accessible when having an account, which I don't. That would mean to solve later puzzles, I would need an account most likely.
I think with a few math tricks you can solve around 25-50, It gets very tough after that without maths background.
Yeah. I think I got to around 10-15 before I got stuck. It's been several years since I attempted it though.
Completely agree! Google + Project Euler was how I learned to code
fake frustration yet another thing named after euler.
12 years ago I was a failed computer science student, wasting my time on drugs. Having failed so many classes I did not see any future at all, and I was considering killing myself to get out of the anxiety and stress. My confidence regarding programming etc was 0.
I decided to apply for a junior developer job. I got an interview and to prepare for an interview I found this site, Project Euler. I did ten or so tasks.
The interview started out pretty bad, they asked me some technical questions which I did not give good answers to, and I saw that they where not impressed. Then they wanted me to solve two programming problems on a white board. Imagine the relief I felt when both of these questions where from the ones that I solved on Project Euler a couple of days before! I nailed them and the interviewers where clearly impressed. In the end they hired me and motivated it with that although I lack a lot of theory I am obviously a very good coder haha.
Anyway, that was what I needed, when I got this job I quit the drugs and got my act together. 12 years later I live a confortable life as a freelancer and have even managed to build my own SaaS with paying customers! Thank you Project Euler.
Good for you! Inspiring stories like yours are positive externalities that will no longer be extant in the same way when everyone’s minds are just thin clients on top of LLMs!
Great story. Are you willing to share more about your SaaS?
I'd love to but I can't be too specific due to the personal stuff I shared in the original comment.
It's a system that helps services companies within a certain industry to digitalize all their paperwork, report to the national goverment agencies etc. They do a lot of manual work which can be digitalized easily.
I found this opportunity by just randomly throwing out in a big community that I build software and is looking for ideas, and some guy answered that ended up being my business partner for 3 years now. We are not rich from it but earn like $2000 each a month after tax which is quite a lot for us since we live in a country where healthcare, schools, parental leave etc are covered by taxes. And we dont need to put more than a few hours a month on support. I have put in basically all my spare time for 2 years to get to this point though, the biggest reward is not the money but the process of sitting through the nights being completely in the zone and building this stuff knowing that it will be great :D
No problem, what you have shared here is very insightful. Cheers to continued success and evenings in the zone.
Congratulations!
sometimes you just need a lucky strike !
I wrote Problem 371, https://projecteuler.net/problem=371 , as a high school student in 2012!
I'm so happy to have spent twenty years of my life learning math and solving problems on Project Euler and elsewhere.
This is one of my favourite problems, I still remember that it has a very real edge case even though I solved it more than 10 years ago. Thank you for the problem!
I'm guessing if you only calculate based on the digits, the probability is going to be slightly different than the real one, because you only have a finite number of plates you can choose from.
Sounds like the birthday paradox problem. Is it?
Nearly, but not 8 digits of precision worth.
I'm glad you enjoyed! It was a real game I played when driving around.
Can you reuse a plate with 500?
The wording seems to strongly imply no; you need two separate plates with 500 on them.
That sounds like a combinatorial problem...alphabets from AAA to ZZZ, numbers from 000 to 999.
That means one of the total sum of possible car plates is 26^3.
Since we want to find pairs (x, y) that x + y = 1000. That means the total sum would also add up sum([1 for x in range(1000) for y in range(1000) if x + y == 1000])/2 since there is a symmetry.
But wait, find the expected number of plates he needs to see for a win. So maybe we need to borrow something from statistics (Possion/chi-squared distribution) or queueing theory...?
Edit: ah I saw the solution, it is a Markov chain.
Interesting- I ask a license plate question (when will california run out of plates in its current serialization format, based on a couple of plates observed in two different years). It's a much simpler question, though (just linear extrapolation).
I wrote Problem 619 (https://projecteuler.net/problem=619) which was published on 2018-01-27 and solved by 474.
The problem was based on 2013 Putnam Exam problem A2 (https://kskedlaya.org/putnam-archive/2013.pdf) which I took at the end of undergrad.
I got an email six years later (in November 2024) telling me they accepted the problem:
Greetings!
Please excuse the email. It's quite possible that you are no longer active at Project Euler, but we are currently trying to retrospectively acknowledge contributors of problems.
You were identified as being involved with Square subsets [619 m] in Sep-17.
If you would like to be added as a verified contributor, please reply to this email and provide the username you currently use at projecteuler.net. Please note that contributor usernames will not appear publicly, rather they will be used internally to unlock new contributor awards we are introducing.
Regards,
Project Euler Team
I was curious if LLMs are good for this problem. ChatGPT-5.1-Thinking one-shotted a correct Python script without any library use (https://pastecode.io/s/jg6ggxpm).
Claude Opus failed to solve after trying for a while.
project euler problems are likely in the RL corpora
First of all, don't do this. No one cares. Secondly obviously every Euler solution is going to appear in the training data many times over. It's no surprise at all that an LLM can regurgitate data that was given to it.
I do care. I appreciate /u/webo's comment. If you're a hater, don't generalize to others. There are still people out there embracing new technologies and change, and with an intact engineering spirit driven by sheer curiosity.
I thought it was interesting, and I wouldn't be surprised if Euler solutions weren't in the training data, especially for the later problems like this one.
I appreciate you trying it! So at least I care.
I used to do these in college to procrastinate my homework. I always had the most difficulty with the problems that required data structures I wasn't exposed to previously and ended up making really complicated solutions that were inefficient as hell, but fun nonetheless.
I might give them a try with golang now that it's my preferred language. I used to do them in python as that was our intro language.
Perhaps you meant to reply to webo? I'm not sure what you think I might have been trying.
Were you also one of Dr. Kedlaya’s students? Or just used that link? I was in an undergrad course of his and really enjoyed it. Such a smart guy.
Ha! I did a lot of these around 2007-2008. I solved the first 100 or so ones. Solving these were more fun than any other programming problems site I've seen. I quit it when I realized I was spending 4+ hours per problem - I couldn't justify the time.
Beyond a certain point, most required some knowledge of elementary number theory.
Same for me, the first 100 are doable, after that they take more and more time and require deeper mathematical knowledge. Which is nice as well, but at some point I started to wonder if it wouldn't be better if I spent all that time on learning some more practical knowledge.
Same timeline for me! This was my great procrastination side quest during grad school. I learned haskell and a bit of ocaml working on these. Functional languages are extremely well suited to these kinds of problems.
I agree with you. About a decade ago, I got really tired of coding interview prep. I somehow ended up getting into Project Euler and worked through the first 100 problems. It was a great way to learn a bit of number theory and regain my interest in programming.
This website was a part of my education as a computer scientist and seeing it here again I'm curious for the full story of how this site was made. Who made it, what do they do now, is it part of a broader project they have?
There is only very basic info here: https://en.wikipedia.org/wiki/Project_Euler
https://archive.is/iEQxy
This article is excellent. It mentions the creator, Colin Hughes, and the story behind the project, but it boils down to a passion project for him.
Back in early 2000s, before hackerrank and similar coding sites, this is what my professors recommended for training programming skills.
Yeah my HS CS teacher recommended it but I don't think it was ever required
The most fun on this site is solving a problem and then having your mind blown by solutions in Apl/j/k and trying to guess what they mean without knowing anything about those languages
I've solved about a hundred PE problems in Livecode, maybe 40 in Python, and about 20 in J. I highly recommend giving it a try in a language you don't know, it's fun! Especially with something as obscure as J.
Even better than the crazy languages, is seeing some fundamental math used to prevent having to do a ridiculously expensive search.
That said, raw brute force often did far better than you'd like to admit.
The biggest thing I learned from PE was that neither elegant theory nor brute force had a monopoly on successful optimization strategies. It's been something I've carried with me ever since and has over and over again proven its value.
A real gem of a resource.
See also Uiua, a newcomer to the "extremely cool but completely incomprehensible language" family!
What's really neat is that most of the problems are so compact that you can just read about the full problem, then spend hours and days thinking about possible solutions.
I created a PDF version that I keep on my Remarkable for puzzling: https://github.com/pveierland/project_euler_offline
I have done Project Euler very sporadically since high school. To date I've only done problems 1-54. Despite this, I think the website was a big contributor to my love of programming. I found it before knowing about leetcode and I think it prepared me well. I think I owe Project Euler a decent %-age of my eventual entry into Software Engineering as a field.
Ditto!
Also a great way to learn a new programming language is to try project Euler problems with it.
These are both a lot more fun, and a lot more educational than leetcode problems. Strongly recommend for anyone looking for practice problems when learning a new language or whatever.
I thank project Euler because whenever I face some coding challenge that has any mathematical inclination, I will(!) impress interviewers. I spent a lot of time on it, and learned a considerable amount of theory and hacks. What a privilege to be able to do this, instead of digging the fields and other manual labor. Thanks culture!
There is a somewhat similar idea behind "Ponder This" by IBM https://research.ibm.com/haifa/ponderthis/index.shtml They post a problem every month and in the end post a solution. I used to spend a bit too much time on those.
The difference is that Ponder This is harder than the average problems in Euler Project, and requires higher level of mathematical maturity.
One of my best memories was in undergrad there was one semester in 2013 where half a dozen of my CS classmates and I competed to try and solve the most Project Euler problems. We had a leaderboard and everything.
I saw first hand how much faster my friend’s Java solutions were than my Python solutions.
Good times.
No one tells you that they delete inactive accounts. I used to have over 300 solved problems htere. Now it is all gone, all the effort, but the skill remained of course.
A few years back (10 maybe?) they had a disk crash, and there was a notice that for people with 100 or more problems solved they'd do an extra effort to recover their solutions and add you back, not sure if it was only posted on the main website. I was lucky to get my account back at the time
Ah okay, I was active there 9-12 years ago, so it migh been before the crash. I remember checking it, however, 7 years ago, and I was still able to log in.
So, I gather that you treated your solutions as throw-away code, rather than keeping them? Kind of surprising, considering that some problems build off of each other, or otherwise benefit from sharing code; you never know when the code for one solution could be useful later. For example, a prime number generator/tester is necessary for many of the problems.
(I have all my solution code, in source control no less, so if I ever lost my account, I could just run them all and re-enter the solutions.)
> So, I gather that you treated your solutions as throw-away code, rather than keeping them?
I kept the code that I found clever or useful, but I had a very borderline approach to archiving my stuff in general back then. I was still in high school.
I remember there were data loss, but my account appears to have been recovered. You may try to login again, and with luck, like me you will get back your history.
I still have the code for the first 50 problems in GitHub. The last commit was thirteen years ago. I don’t know why I checked these in rather than treating them as throwaway code like I did for so many other things, but I’m glad I did as I’m sure my PE account is gone now too.
How long before they start deleting? I haven't logged in for 5 years and my account is still there.
Whelp, the opening “problem zero” stuffed me up.
> A number is a perfect square, or a square number, if it is the square of a positive integer. For example, is a square number because ; it is also an odd square. The first 5 square numbers are: , and the sum of the odd squares is . Among the first 881 thousand square numbers, what is the sum of all the odd squares?
I wanted to use Uiua, and hence:
/+ⁿ2+1⍜÷⇡ 2 881000
But Uiua doesn’t support big ints, just f64. So yuck, python to get an accurate answer. Just sad now.
How did you get to problem 0? When I look at the list of problems it starts at 1: https://projecteuler.net/archives
It’s the “sign up” challenge
This will become a practice of implementing bignums in your language of choice, which is a valuable exercise itself.
I did this (bignum) library for Livecode specifically for PE. https://github.com/gcanyon/bignum
I ranked on that once! I was like the 23rd person to do one of the new problems one time. Just about as low as you can rank. It was a fun puzzle but you had to be awake at a funky time to do it.
I was trying to create an account but it kept saying the confirmation code was wrong. Idk if that's a bug but... I was using the audio captcha. Still, the website seems pretty neat!
During my university time, I used to do a lot of different programming puzzles and algo. I think it an invaluable training that every serious engineer should try without relaying on AI.
Skills are trained by practice and thinking. Skilled people will never be subsidized by AI. Unskilled juniors, who don't train properly will go into tranches (as it's already happening).
Project Euler spurred my love for math and programming when I was 15. I got through the first few with pencil and paper and then quickly realized I was going to need to learn how to program. Got started with Java (in Eclipse) and then moved on to Python. I feel like it completely changed the trajectory of my life.
Are there other similar sites? I remember this one, for bioinformatics
https://rosalind.info/problems/list-view/
I solved a few using AWK, fun: https://github.com/ketancmaheshwari/projecteuler
After learning AWK I realised it could be used really neatly for problem 67. I remember it was blazing fast, orders of magnitude faster than Python
Did you use the regular version or the one with multiple-precision values?
Like many others here, Project Euler was foundational in my education and growth as a programmer.
Leonhard Euler himself is an incredible figure and arguably the most prodigious contributor to mathematics throughout history. So much so that people started naming things discovered by him after the next person to have proved them.
https://en.wikipedia.org/wiki/List_of_topics_named_after_Leo...
Maybe Gauß takes that trophy. To me it felt in mathematics lectures, that Gauß had his hand in everything. Euler might have had that too, but I am not that aware maybe.
I attribute project euler for instilling the playful enjoyment of writing programs in college while I was studying electrical and computer engineering. I owe my career to it!
I think a hat-tip is due to freeCodeCamp for introducing Project Euler (along with Rosetta Code) to a new generation of programmers:
https://www.freecodecamp.org/learn/project-euler/#project-eu...
i think its a decent environment to do the programs - ok restrictive to js but lets you focus on the problems
I learned so much from this site- including that so much education comes from being prompted to ask the right questions.
A great one of my favorite websites of the past. Wonder how they are coping with the issue of their users using AI to solve problems.
I suppose I wonder how those users are coping with having the robots do all the stuff instead of them doing some of the stuff.
It is a mostly single player game, if users want to cheat they are only cheating themselves really, right?
I love a good puzzle solving club. Some of my favorites: https://www.themastertheorem.com/ https://en.wikipedia.org/wiki/Perplex_City https://en.wikipedia.org/wiki/MindTrap
Since this is still on HN frontpage. Does anyone suggest any math books to help solve these problems. I am pretty sure you can't solve problems above 50 without strong maths background.
Concrete Mathematics is probably the best single book that you could read to prepare you for some the problems beyond the first 50. It’s extremely fun, and also mathematically serious. A large portion of PE problems are exactly in the cross sections of number theory, combinatorics, and computation that is covered in this book.
https://en.wikipedia.org/wiki/Concrete_Mathematics
I discovered project euler as a novice programmer in high school around 15 years ago. I loved how solving a problem unlocks a secret forum only available to other solvers. I would spend hours reading through everyone's prior solutions and trying to understand them. One guy had tagged his profile as "haskell" but would always provide his solutions in ruby which threw child-me for quite a loop (I actually thought ruby and haskell were the same language for some time)!
Wow, I can't believe this is still around! I'm glad to see artifacts from the past like this are still out there on the internet.
Makes me miss Google CodeJam though.
I remember it vaguely but there used to be a badge awarded for being among the first 100 people to solve the problem. I was obsessed with getting that badge to the point that I spent obscene amount of time solving the-then recently released problem even when the following day was my final exams. I did manage to get that badge though. This was circa 2013. Fun times!
After opened https://projecteuler.net/ I got
403 Forbidden Request forbidden by administrative rules.
Note: I didn't know and open this website until now.
Well, that sucks!
Project Euler was what I used to get comfortable with my two main languages -- first python and then rust.
I loved to solve it and then look through all the different solutions and find pretty ideas and idioms.
I love running euler problems when trying to learn the basics of a new programming language. I have a small collection of programs in like 10 different languages that I keep around as a reference for things because I always try to use language-specific features to solve the problems, and then I reference them as examples.
Wow. You reminded me of a computer engineering class years ago where we wrote assemblers and emulators for a simple architecture. I tested mine by writing a solution for one of the first Project Euler questions!
I still have my Oberon-2 compiler from my compilers class and a handful of Euler questions I used to test it.
So, to remind myself, Euler's name is pronounced more like Oiler, right?
That's how I was taught, and Wikipedia agrees (and even provides audio clips alongside the IPA and English phonetic transcriptions).
I too owe had my love for programming captured through project Euler. I am immensely grateful to my maths prof who introduced me to it.
I also love looking back at my old PE code and having absolutely no idea what it doing. No comments, no docs, no notes. From a different era.
So much more fun than leetcode. OTOH, unlikely to help you in an interview.
It would help you if I were doing the interview…
I remember visiting Project Euler back in 2013/14 or so. Was really my first introduction to programming exercises as youngin. Probably did fifteen or so of them before ADHD kicked in though. A small gem on the web.
I did a lot of these when I was around 15-16 and it solidified for me my interest in CS but in general abstract thinking and problem solving. Great site.
i was a euler fanatic some years ago reaching problems in the 500s albeit, skipping problems along the way. at that point, too many problems required a deeper math background than i possessed so i abandoned it. what amazed me was that others composed solutions that solved problems in mere milliseconds that brute force approaches would still be running when the universe cooled to absolute zero.
I only reached the 100s back in the day. What amazed me was that it seemed like every problem had a paper solution, when it would take any computer algorithm thousands or millions of computations to solve the same problem.
I played around with some of the easier problems, my favorite was a couple times when starting with the obvious brute force solution in code and then refactoring and simplifying it iteratively ended up getting me the paper solution.
Anyone else having problems registering? or is my solution to Problem Zero wrong...
Thousand of hours on this. Love it.
very surprised this project is still releasing problems weekly - I remember this being up when I was in high school. maybe I'll pick it up again since I only did the first ~30 or so back then.
Not only are they still releasing problems weekly, they have a long backlog of problems waiting for release. I submitted a problem back in April 2024, and it didn't get published until October 2025 (problem 963). There's an excellent core development team that works with problem-submitters to get problems tuned up for Project Euler.
Anyone else having problems registering or is my solution wrong?
This is such a great site.
How I learnt about prime number sieves.
Good prep for Advent of Code in 2 weeks.
The leetcode before leetcode. Hail.
this is how you end up getting into APL/array langs for sure.
Second this ... have been writing some solutions in Kap, an APL like variant. It's stunning to see 20+ idiomatic solutions in one screen as many problems can be solved in a compact manner. The elegance really reminds one of why we fell in love with Programming in the first place
Thanks for reminding me this; I'd try to solve them both in Scheme (s9fes) and JimTCL.
2007 I remember writing one-liner ruby solutions up to 100.
Hackerrank also used to host(still has?) PE problems with additional test cases.
Glanced at the exercises. It appears that two of them have numbers arranged in a triangle and ask for a longest path.
Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x. For the resulting triangle, solve it to give the shortest path using one of the well known network shortest path algorithms.
The "well known" path algorithms in this case are overkill; the graph is a tree. And Dijkstra is not really designed to handle negative edge weights (although it would probably function correctly in this instance).
> Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x.
By the time you've actually done these two steps, you could have already finished the problem with a dynamic programming approach.
(Starting from the bottom row and working upward, replace each cell in the row with the length of the longest path from itself to the bottom, which you can know by checking which of its two children has the longer path associated.)
[dead]
[flagged]
Nobody is interested in AI commentary.
That seems incorrect. This sub-thread is the longest already in this submission, and no other commenter remarked about the parent commenter being an AI.
I've personally found the opposite. In order to advance you need to know the specific techniques or mathematics and there are no hints or information on how to approach the problem. So it boils down to how much of that mathematics you know. If you don't then the brute force approaches take a long time to find the solution.
I disagree.
Often the techniques that you need for a harder problem, are discussed in a forum for an easier problem. Even more often the techniques that you need for a given problem are possible to work out from scratch. And the more you work out, the easier they get.
This can be very frustrating for people who are used to being spoon fed techniques, then given problems which use what they have just been taught. But it is a lot of fun for people who enjoy puzzles. If it isn't your cup of tea, that's fine. But don't dismiss it for people who enjoy it.
Disclaimer. I haven't personally engaged in the last few years, but I've spent a lot of time on it. I solved 598 and contributed a couple of puzzles as well. One of which they immediately saw a way to do that I hadn't, and put it out there with a difficulty level that I didn't know how to do! That was https://projecteuler.net/problem=240.
Wait, the math is discussed only in the forums? I thought one is supposed to gain mathematical insight from solving alone. As far as I have read here, forums are only accessible when having an account, which I don't. That would mean to solve later puzzles, I would need an account most likely.
I think with a few math tricks you can solve around 25-50, It gets very tough after that without maths background.
Yeah. I think I got to around 10-15 before I got stuck. It's been several years since I attempted it though.
Completely agree! Google + Project Euler was how I learned to code
fake frustration yet another thing named after euler.