Project Euler
I have recently been working through some of the problems on Project Euler. The site has a series of mathematical problems to solve. Each can be solved by writing a program to calculate the answer. An answer of one of the simpler problems is “Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.” and the solution is quite simple shown here in Python.
squareTotal=0
sumTotal=0
for num in range (1,101):
sumTotal += num
squareTotal += num*num
sumSquare = sumTotal*sumTotal
print sumSquare-squareTotal
Some of the problems are much more difficult however, they have a rule that all of the problems should be solvable on a modest PC in under a minute of computation. There are some that I have written where my first attempt would have taken several months to run but I have refined it down to about 10 minutes. There is a forum that you get access to once you have solved each problem. There are posts with other peoples’ solutions in a vast array of languages which can be quite interesting. That particular problem had a solution that ran in under 10 seconds.
There is well over 200 problems and rising so it should be enough to keep anyone busy for a while. I will post any interesting solutions as I come across them.
[...] while ago I posted about Project Euler, I haven’t done any of the problems on there since about then so I might do that to get me [...]