Solve euler problem 22