P100: Optimized Java solution by appealing to Pell's equation.
P56: Added Haskell solution.