projecteuler.net
Solving problems from http://projecteuler.net/index.php?section=problems is my hobby. Currently I have almost zero time to do that. But when I have a spare minute and proper mood, I solve those using R6RS Scheme (currently with PLT). Scheme is chosen for several reasons. Most important, I want to improve my schemer-skills. One of the secondary reasons: the Scheme's numerical tower is capable of handling of virtually infinitely large numbers, so no reason to worry about numerical overflows. Those problems from projecteuler often require large numbers.
I also try to do quick-n-dirty performance and memory analysis. This is secondary, if it doesn't come fast, I go on. It's more interesting to dive into analytical aspects. Later I plan to automate measurements of speed, so it will be possible to check theoretical asymptotics.
Postings at this blog, filtered with the tag 'projecteuler': http://lakhturov.info/tag/projecteuler/
Repository:
https://github.com/lakhturov/Project-Euler-Solutions
Git access: git://github.com/lakhturov/Project-Euler-Solutions.git (feel free to clone and play)
To do: Here will be a table with information regarding solved exercises.
Problem + Link to projecteuler.net / Solution + Link to this blog | Theoretical speed asymptotics | Theoretical memory footprint | Comments |
1. Find the sum of all the multiples of 3 or 5 below 1000. | Sum of multiples of k numbers below n. | ||
bruteforce | ~ k * n | Θ(n) | Only sought numbers are in the memory |
via LCM and inclusion-exclusion principle | ~ | Does not depend on n (good, as k << n) | |
LCM of k integers | ? | ~ k ? | Generic is not written yet, as GCD is also needed |
To do: adding code snippets at mouse hover is a nice idea.