P41, P42: Added Mathematica solution.
P42: Simplified Java solution and renamed items.