added combinatorics test
handle empty ranges
simplified subfactorial calculation