I know it's a lot to ask for help in my first post, but I've been at this question for over a day, and I've searched every corner of the internet for an answer. Any help will be repaid in kind on this forum.

http://imgur.com/dfmCI

What I don't understand is, in the working, how did they determine that 21 different permutations of the ranks would give a sum of squared differences of 6 or less.

Is there any way to figure this out without laboriously calculating the sum of squared differences by hand or by using a program?

My solution to the problem was to calculate the Spearmans Rank Correlation and this was r*s = 0.828 which with n=6 would give a critical value of between 0.025 and 0.05. But then the question did ask for an exact p-value.

Again, I would deeply appreciate any insight!