Permuatations with ties

Is there a general formula for the number of permutations of n elements when ties are allowed? With two elements there are 3: a < b, b < a, a = b

With three elements there are: 13 (3! = 6 permutations with no ties; 6 with one tie: c < a = b, a = b < c and two more each with a or b as the untied, and one three way tie).

Before counting I thought the answer was 2^(n-1)n! since there were 2^(n-1) ways to put either the < or = sign into each permutation, but I realized this double counted (each one way tie could be found in two of the permutations).

This is not homework. I’ve not had homework in more than 35 years. :slight_smile:

Another term for this would be the number of total preorders on an n-element set. (Another, very silly term would be the number of “strict weak orderings”).

Anyway, your answer is the series of Fubini numbers/ordered Bell numbers. There doesn’t appear to be a “nice” formula.