Euler: Solved problem 31