Euler Project Exercise 4