Live data from Hacker News

Project Euler

projecteuler.net

101–110 of 142 posts

Re: Project Euler

#101
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.

Re: Project Euler

#102

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

Re: Project Euler

#105
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.

Re: Project Euler

#106

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

Re: Project Euler

#107
post #12

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).

Re: Project Euler

#108
post #33

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.

Re: Project Euler

#109

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.

Re: Project Euler

#110
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.

Post reply on HN