use combinations instead of permutations, this gives a big speedup