Live data from Hacker News

Project Euler

projecteuler.net

11–20 of 172 posts

Re: Project Euler

#11
Project Euler was so much fun when I discovered it, it also helped prepare me for an unexpected interview which included similar challenges and they seemed a breeze in comparison. Had I not been challenging myself, no way would I have passed.

Solved 38 problems and forgot my password after a short pause, haven't been able to log in for years :(

Re: Project Euler

#12

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…

I've used it for the same purpose, but one thing to bear in mind is the problems are incredibly focused on a small domain, so while you can pick up some bits of a language, it is nowhere near a thorough introduction.

Re: Project Euler

#13
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 =…

The best point to be made from this isn't that it's more computationally efficient. It's that, compared to something like sum [x | x which is really just bluntly translating the question into a programming language and letting it take care of the rest, your approach involves some actual insight into the underlying math.

What language is this?

Re: Project Euler

#14

Earlier quoted context omitted.

The best point to be made from this isn't that it's more computationally efficient. It's that, compared to something like sum [x | x which is really just bluntly translating the question into a programming language and letting it take care of the rest, your approach involves some actual insight into the underlying math.

What language is this?

[deleted]

Re: Project Euler

#15

Earlier quoted context omitted.

The best point to be made from this isn't that it's more computationally efficient. It's that, compared to something like sum [x | x which is really just bluntly translating the question into a programming language and letting it take care of the rest, your approach involves some actual insight into the underlying math.

What language is this?

Haskell

Re: Project Euler

#16

Earlier quoted context omitted.

The best point to be made from this isn't that it's more computationally efficient. It's that, compared to something like sum [x | x which is really just bluntly translating the question into a programming language and letting it take care of the rest, your approach involves some actual insight into the underlying math.

What language is this?

It’s a Haskell list comprehension. You read it as:

The sum of x for x from one to 999 where x mod three is zero or x mod five is zero.

well, the bit in square brackets is a comprehension. `sum `is just ordinary function application.

Re: Project Euler

#17

Earlier quoted context omitted.

The best point to be made from this isn't that it's more computationally efficient. It's that, compared to something like sum [x | x which is really just bluntly translating the question into a programming language and letting it take care of the rest, your approach involves some actual insight into the underlying math.

What language is this?

[deleted]

Re: Project Euler

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

Re: Project Euler

#19

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…

(They do ask not to share the solutions.)

But nice job translating them :-)

Re: Project Euler

#20
post #8

Solutions here: https://github.com/luckytoilet/projecteuler-solutions

From the Project Euler website:

I learned so much solving problem XXX so is it okay to publish my solution elsewhere?

It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

Post reply on HN