Solves Problem 54 in Project Euler