Project Euler, Problem 34, Java, now terminating with reasonable limit