Solution to problem 2 on euler