Distribution of Spearman's Rho

JavaScript
Spearman's rho is related to the statistic Sn=(R1-1)2+...+(Rn-n)2
where (R1,R2,...,Rn) is a permutation of the integers from 1 to n.
Here you can find the distribution of Sn when the permutation is
chosen at random uniformly over all n! permutations.
      Enter Spearman rho Arguments:

      sample size n: 
            s-value: 

P(Sn <= s):

The statistic Sn takes values in the even integers between 0 and
(n-1)n(n+1)/3 inclusive. The distribution is symmetric about the mean,
(n-1)n(n+1)/6, and the variance is n2(n+1)2(n-1)/36.

The distribution function of Sn is computed exactly for n<=8.
For n>8, a normal approximation with continuity correction is used.
For n>8, the maximum absolute error of the approximation is .003.