Trying this in prolog...
Attempts at problems 73 and 78
Going back to C for performance