P171: Added Mathematica solution.