Very brute force attempt at problem 3.

Pair @iammcn.