Project Euler #14, optimizable?