Completed exercise 1 from Project Euler