DOWNLOAD-DESKTOP-NOTEBOOK.nb (79.6 KB)
The value of unioncheck[n] can be derived as \frac{n^n}{n!}-1.
p_0, The value of the first permutation (i.e. Range[n]) is given by
while the p_{n!}, the value of the last permutation (i.e. Reverse@Range[n]) is given by
The sum of the two is given by
The sum of the first and last values of reflocs[n] is r = (n!+1) \frac{n^n}{n!} , so therefore the value of unioncheck[n] is given by
Table[n^n/n! - 1,{n,7}]
(*{0, 1, 7/2, 29/3, 601/24, 319/5, 116929/720}*)
You may also be interested in the fact that the position of a permutation perm of Range[n] in Tuples[Range[n],n] is given exactly by 1+FromDigits[perm -1,n] :
Flatten@Table[permlocs[n], {n, 5}] ==
Flatten@Table[
1 + FromDigits[# - 1, n] & /@ Permutations[Range@n], {n, 5}]
(*True*)
Thank you for your very helpful reply!
– you have earned Featured Contributor Badge ![]()
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!