TITLE: probability of sorted array with duplicate numbers
QUESTION [7 upvotes]: Suppose I have a sequence of n numbers 
{a1,a2,a3,...an} where some of the numbers are repeated. What is the probability that the sequence is sorted?

REPLY [3 votes]: Usually, if the numbers were not repeated the probability would be 1/n! where n! is the number of possible sorted combination while just one is the correct one. As the number can be repeated, the number of each repeated numbers (for example {2,2,...,2}) can be between 1 to n and the number of different repeated numbers  can be between 2 and n/2  (for example {1,1,2,2,3,3,4,4, ... ,n/2,n/2}). So the probability will be {C(n, 1) + C(n, 2) + ... + C(n, n)} / n!.{C(n/2, 2) + C(n/2, 3) + C(n/2, n/2)}