Fast approximation of small p-values in permutation tests by partitioning the permutations