This is Luka Milekic's solution to project euler problems 18 and 67 (same algorithm works for both). If you haven't solved these problems don't cheat yourself from the fun.