some combinatorics functions in python