Speed up IsPrime by only dividing by primes in the list, in cases where
the number under test is higher than the maximum prime.
Slightly cleaned up version -- do the test faster
New version based on solution found on the site -- rather than
generating the graph and permutations, just generate all combinations
in increasing numeric order and then the first solution you find will be
the lowest -- went from pypy 20 seconds down to 3!! and Python went down
to 20 seconds from a couple of minutes.