Close, very close

Phew! Fixed a few bugs. Now passes very small AND small inputs. Looks
like I have a hang on large input, though. Good grief, what a beast this
has been. I bet the analysis has a super-easy way to do it. At least I
didn't need to cheat!