Program for Project Euler Problem 2