Solve Euler 014 (pre-optimization).