Project Euler
projecteuler.net
Project Euler
1–10 of 172 posts
Re: Project Euler
#2It'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 efficient solution to the problem.
Ps: you can find the first 50 problems in french here : https://www.lucaswillems.com/fr/articles/19/project-euler-tr...
Re: Project Euler
#3Re: Project Euler
#4I 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…
Re: Project Euler
#5Sadly, only a small portion of the solutions posted are retained, so if you're not looking for Python or C you'll probably only see a couple of different variations in your language of interest. It would be a huge deal for learning new languages if we could retain all solutions and then sort or filter by language.
Re: Project Euler
#6https://uva.onlinejudge.org/index.php?option=com_onlinejudge...
Re: Project Euler
#7Re: Project Euler
#8Re: Project Euler
#9" 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 = 99500
We must subtract common multiples (those of 15), so (15 .. 990) = (1 .. 66) * 15 = 0.5 * 66 * 67 * 15 = -33165
166833 + 99500 - 33165 = 233168
O(1) solution FTW :P Nice looking code is good, but a smart algorithm makes a big difference. "
OK, I was a smug arsehole, but there's a point to be made y'know?
Re: Project Euler
#10Ah, 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 =…
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.