HackerRank Project Euler #4