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. 