Problem 10.

This is a pretty slow solution.  It takes about 3.5 minutes
to compute on my machine in Firefox.