Problem 7.

This is a very non-performant solution that will only run in Firefox
(because of generators.)  It takes about 5 minutes to complete on my
machine and, obviously, triggers a script timeout warning.