Project Euler - Problem 21, Java