Helper code for problems from Project Euler.