Live data from Hacker News

Project Euler

projecteuler.net

131–140 of 172 posts

Re: Project Euler

#131

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.

I agree that solving them with pen and paper is bad ass.

But many problems cannot be solved using brute force. They will give you one problem that can be solved using brute force, then in a later problem they increase some n to the point where it cannot be solved using brute force. So it forces you to find a better solution.

Re: Project Euler

#132
post #60

Earlier quoted context omitted.

Well Python got it from Haskell. I thought I made it clear enough. See https://docs.python.org/3/howto/functional.html

Well years ago, I saw a discussion that put this in the context of python's generators being inspired by what was in Icon.

I'm just now looking at Icon code for the first time, but, to me, Python's list comprehension syntax looks more similar to Haskell's than Icon's.

Re: Project Euler

#133
post #73

Earlier quoted context omitted.

I have found that for me, a classical musicians although somewhat mathematically inclined, most problems up to about problem 100 were solvable with my maths book and some helpful pointers. I ended up spending too much time per problem (days to weeks) and then I got a kid, so that time is being spent on better things.

Can you provide a link for this? I'm very interested in it.

What exactly do you want a link to? I just used my friend's old maths books from high school (he did all 7 courses available, which means about 25% of his 3 year HS studies. It includes stuff like linear algebra and linear optimization and game theory. ) and lots of time.

He went on to become a PhD in maths and just pointed me in the right direction when I couldn't figure stuff out myself.

Re: Project Euler

#134

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 ?

I've solved 273 as of now ( https://projecteuler.net/profile/NabiNaga.png ). It took me a little less than 2 years to get to 250 problems, but I was spending quite a bit of time on them haha. I've learned an incredible amount of math and algorithm skills from PE. There have been lots of really challenging ones, but one that stands out is 494. That was the first "really hard" one I solved, and my first time to be in t…

That is quite an achievement. Can you comment on your background ? type of education, work.

Re: Project Euler

#135

Back in the day I solved the first ~100 problems in order. It was a great practice to sharpen your programming logic and I learned a ton of math. The problems became harder. But I haven't done any in many years. Do you think the newer problems are very very hard ? I have to admire the dedication of those who have kept on it.

It is possible to sort them by difficulty. Some of the newer problems are easier than some of the first 100 problems, appearantly.

Re: Project Euler

#136
post #73

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 have found that for me, a classical musicians although somewhat mathematically inclined, most problems up to about problem 100 were solvable with my maths book and some helpful pointers. I ended up spending too much time per problem (days to weeks) and then I got a kid, so that time is being spent on better things.

My advanced algorithms professor at University has the prerequisite for doing research with him of solving Project Euler questions from 1-100. He had some sort of time table on it like 1-3 months, but also said if you solved them all in a shorter period like 1 week that you were too good to learn anything from doing research with him.

So, honestly you just doing 1-100 as a classical musician is really surprising and amazing to me. Great job!

Re: Project Euler

#137
post #92

I guess I'm becoming an old fart. I used to like programming puzzles, challenges, things like this. But as time marches on, I realize that the real-world problems I have to solve are already so challenging and require enough critical thinking, that I'm best served just focusing on them. Between family life, doing real-world challenges for income, downtime to breathe, diverse hobbies for the spiritual good of my perso…

I am the same though I'm only 30. I no longer seek out puzzles but to solve interesting real world problems. The time you put into a challenging Euler puzzle, you can use React/Rails/NodeJs/Go/Rust/lang du jour to solve real world problem, helping real people. Also as a liberal arts in programming, Euler, is fun in the sense of a well done proof is fun in math. If that is your thing you'll enjoy Euler, otherwise as i…

I definitely agree that puzzles/challenges for their own sake are pretty pointlesss. However, I also think (guided) puzzles/challenges are really good for learning new tools/languages. It can be hard to just sit down in front of a real world type problem with even just one new tool and know what to do with it.

The best approach is probably somewhere in the middle. Best example I've seen of this are the "workshopper" lessons on NodeSchool.

Re: Project Euler

#138

Earlier quoted context omitted.

to see it consider this: S = 1 + 2 + 3 + ... + n-1 + n + S = n + n-1 + n-2 + ...+ 2 + 1 = 2S = n+1 + n+1 + n+1 + ... + n+1 + n+1 every column sums to n+1

Random fact: this only works if the series is finite. Otherwise you end up with sum(1...inf) equaling -1/12.

That's the sum of all integers on the complex plane, solved using an analytical continuation of the Riemann zeta function at -1 (fwiw, by the same definition, the sum of 13, 26, 39...inf is also -1/12).

It's disingenuous to assert that is same as the sum of that infinite series without the associated caveats. By the definitions of infinite series that we all learned in calculus, that is a divergent series with no sum.

Edit: Wolfram Alpha[0] has a good graphic showing why this series converges to -1/12 (the one with the red line, drawing a peach-like shape). It also gives an intuition as to how complex numbers are influencing the results despite being omitted from the equation.

[0] http://mathworld.wolfram.com/RiemannZetaFunction.html

Re: Project Euler

#139

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…

> It really is much more about math than programming

This illustrates one of my favorite things about Project Euler. How you perceive it depends totally on your background: programmers say it's mostly math, math people say it's mostly programming!

Re: Project Euler

#140

To ask people who solved many of these questions: Once you find "the" trick, is there still a lot of computation involved? Do you still write loops? How many orders of magnitude times do those loops run? How do you know when your code is too computationally intensive and you haven't found "the" trick yet?

Somewhere in the instructions it says that your solution should run in less than a minute on ordinary computer hardware. Sometimes it's just as interesting to make your brute force solution more performant as it is to find 'the trick.'
Post reply on HN