math.combinatorics: make permutations-quot to reduce code duplication.