Pastable version of Euler Problem 2 solution