login
Self-inverse infinite permutation which shows the position of the inverse of each finite permutation in A060117 (or A060118) in the same sequence; or equally, the cross-indexing between A060117 and A060118.
18

%I #20 May 14 2020 07:41:35

%S 0,1,2,5,4,3,6,7,14,23,22,15,12,19,8,11,16,21,18,13,20,17,10,9,24,25,

%T 26,29,28,27,54,55,86,119,118,87,84,115,56,59,88,117,114,85,116,89,58,

%U 57,48,49,74,101,100,75,30,31,38,47,46,39,60,67,80,107,112,93,66,61,92

%N Self-inverse infinite permutation which shows the position of the inverse of each finite permutation in A060117 (or A060118) in the same sequence; or equally, the cross-indexing between A060117 and A060118.

%C PermRank3Aux is a slight modification of rank2 algorithm presented in Myrvold-Ruskey article.

%H Antti Karttunen, <a href="/A060125/b060125.txt">Table of n, a(n) for n = 0..5040</a>

%H W. Myrvold and F. Ruskey, <a href="https://doi.org/10.1016/S0020-0190(01)00141-7">Ranking and Unranking Permutations in Linear Time</a>, Inform. Process. Lett. 79 (2001), no. 6, 281-284.

%H <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%p with(group); permul := (a,b) -> mulperms(b,a); swap := (p,i,j) -> convert(permul(convert(p,'disjcyc'),[[i,j]]),'permlist',nops(p));

%p PermRank3Aux := proc(n, p, q) if(1 = n) then RETURN(0); else RETURN((n-p[n])*((n-1)!) + PermRank3Aux(n-1,swap(p,n,q[n]),swap(q,n,p[n]))); fi; end;

%p PermRank3R := p -> PermRank3Aux(nops(p),p,convert(invperm(convert(p,'disjcyc')),'permlist',nops(p)));

%p PermRank3L := p -> PermRank3Aux(nops(p),convert(invperm(convert(p,'disjcyc')),'permlist',nops(p)),p);

%p # a(n) = PermRank3L(PermUnrank3R(n)) or PermRank3R(PermUnrank3L(n)) or PermRank3L(convert(invperm(convert(PermUnrank3L(j), 'disjcyc')), 'permlist', nops(PermUnrank3L(j))))

%Y Cf. A060117, A060118, A060126, A060127, A275957, A275958.

%Y Cf. A261220 (fixed points).

%Y Cf. A056019 (compare the scatter plots).

%K nonn,base,look

%O 0,3

%A _Antti Karttunen_, Mar 02 2001