Routines for combinatorics
