Distribution of N balls numbered 1 to N with replacement An urn contains N balls numbered 1.2.3...N.
I draw at random n balls, one by one with replacement.
Let X the smallest number, the largest Y and S the sum of all the n numbers
How to compute:
-the probability P(X=x,Y=y)  that X=x AND Y=y 
-the probability that S=s 

Thanks to Dennis for his comments.
So, I think the answer to the first question is:
P(X=x,Y=y) = 1/(N^n)  *  [ (y-x+1)^n  -2 (y-x)^n  + (y-x-1)^n ]
