combinatorics in scala