Copied some code which will help build the fast answer to Euler5.