Cheat a bit (know the answer from a C++ solutions). This runs
quite slow. The C++ version was also slow (~45 minutes). Didn't
have the patience to really time this one, but this solution
is brutish and slow.