Live data from Hacker News

Project Euler

projecteuler.net

61–70 of 172 posts

Re: Project Euler

#61

I really like to use project euler when I want to learn a new language. Exercises are sorted more or less by difficulty, at least for the first 50-100, and are completely langage agnostic (you just need to answer a question in a text input). It's also very good to learn algorithm and maths. Some problems can even be solved without any programming. And for some, a certain amount of math is necessary to have a efficien…

> Some problems can even be solved without any programming.

Here's a fairly comprehensive list of those problems, but it hasn't been updated in a while, e.g., 601 is solvable with pencil and paper but it's new enough that it isn't on the list.

https://projecteuler.chat/viewtopic.php?t=1982

Re: Project Euler

#62
post #50

I've solved #555 and #561, which were a lot of fun. Any other good recommendations? Some of the questions in that area look pretty intimidating, but those two were surprisingly approachable.

#601 is pretty easy. Also, #512 and #521 if you have some background in prime number theory.

Re: Project Euler

#63
post #9

Ah, memories. Back in 2010 I whinged to colleagues who were using their fancy functional languages to solve problem 1 inefficiently in 2 lines of code... " Project Euler problem 1 :- It helps to know the sum of (1 .. x) is 0.5 * n * (n+1). Multiples of 3 less than 1000 are (3 .. 999) == (1 .. 333) * 3 = 0.5 * 333 * 334 * 3 = 166833 Multiples of 5 less than 1000 are (5 .. 995) == (1 .. 199) * 5 = 0.5 * 199 * 200 * 5 =…

> It helps to know the sum of (1 .. x) is 0.5 * n * (n+1) This is cool. As someone out of full time education, and who dropped maths relatively early, where’s a good place to start learning some of this stuff? By stuff I mean things related to algebra and whatever the black magic I quoted is

You may have a look at “The Magic of Math” [1]. I’m reading it right now and I am loving it. It contains a lot of interesting problems from arithmetics, algebra and geometry. They are well explained and show that math is about creative thinking and not about memorizing equations.

[1] https://www.amazon.com/Magic-Math-Solving-Figuring-Out/dp/04...

Re: Project Euler

#64
post #34

The best tool for solving these problems is a whiteboard; writing code should be seen as a last resort, and brute-force solutions should be shunned, as they provide no insight.

Some friends and I used to hold a hybrid drinking/Project Euler contest. You would have hated our solutions. I remember winning on the back of nine nested for-loops and, on a separate occasion, doing a primality check using a literal array containing the first 80,000 primes. That's what happens when time-to-solution is what you optimize for. I'm sure it's familiar to startup programmers :).

Wow, that sounds like an awesome party =)

Re: Project Euler

#65

After hearing about it for years, I decided to start working through Project Euler about two weeks ago. It really is much more about math than programming, although it's a lot of fun to take on the problems with a language that has tail call optimization because so many of the problems involve recurrence relations. I like that the problems are constructed in a way that usually punishes you for trying to use brute for…

My only real complaint is (according to my experience) unless you happen to understand some mathematical concept/s involved in the question, it's incredibly difficult to get some insight or clue for how to go about solving it. The forums are a fantastic resource once you already know how to solve the problem .

I definitely wish there was a hint system / forum where you could get pointers towards concepts you should read up on, and not the full answer.

Re: Project Euler

#66

Earlier quoted context omitted.

My only real complaint is (according to my experience) unless you happen to understand some mathematical concept/s involved in the question, it's incredibly difficult to get some insight or clue for how to go about solving it. The forums are a fantastic resource once you already know how to solve the problem .

I definitely wish there was a hint system / forum where you could get pointers towards concepts you should read up on, and not the full answer.

There are forums for the problems where you can ask for general directions, so long as hints are not asked / provided.

Re: Project Euler

#67
post #50

I've solved #555 and #561, which were a lot of fun. Any other good recommendations? Some of the questions in that area look pretty intimidating, but those two were surprisingly approachable.

#208 is what got me started

Re: Project Euler

#68
Are there any 200+ PE readers here ? If so, how long did it take you to reach you level and what was the most challenging problem you solved ?

Re: Project Euler

#69
post #30

Earlier quoted context omitted.

Right. We don't actually know whether this Haskell code is less efficient - that depends entirely on the implementation.

Compared to grandparent's method of calculation (9 multiplications, 3 additions, no comparisons, no iteration), the Haskell code is almost certainly less efficient. I can't imagine the Haskell maintainers would spend time on an optimization that is so impractically purpose-specific.

I don't think it's unreasonable to expect it. E.g. clang -O1 (https://godbolt.org/g/7qzSF9 ) is able to use the closed form for a sum on a simple C++ loop. It's not unreasonable that a language with deeper introspection could identify more closed forms. I agree that I don't think the Haskell maintainers would put this specific example in, but I wonder whether they could build it up from simpler primitives.

Re: Project Euler

#70

After hearing about it for years, I decided to start working through Project Euler about two weeks ago. It really is much more about math than programming, although it's a lot of fun to take on the problems with a language that has tail call optimization because so many of the problems involve recurrence relations. I like that the problems are constructed in a way that usually punishes you for trying to use brute for…

I agree with Project Euler being mostly about math. I prefer Codewars for practicing programming or learning a new language.

Euler was a mathematician after all. Now thinking about it I wonder what project Djikstra would look like, or say maybe project Stallman.
Post reply on HN