Tinkering with Eulerian maths from projecteuler.net using Java wizardry.