Problem 21, brute force solution finished. Runs fairly fast, but more speedups would be possible by setting some better bounds