%I #15 Mar 09 2024 01:45:19
%S 1,3,2,9,6,5,4,23,16,11,26,14,10,8,7,52,37,27,57,62,18,41,85,34,24,17,
%T 38,21,15,13,12,109,79,58,116,126,42,86,168,253,92,29,133,179,63,125,
%U 238,74,53,39,80,88,28,59,118,49,35,25,54,32,22,20,19,214,158,117,225,240,87,169,316,463,181,64,256,335,127,239,438,851,352,134,484,265,44,189,657,630,254,93,353,461,180,334,600,151,110,81,159,172,60
%N a(n) is the (reversed lexicographic, alias Mathematica ordering) rank of the partition associated with integer n by encoding the run lengths of the binary representation of n.
%C Defines an infinite permutation on the integers, containing cycles of infinite length, but with an inverse (A229120) that can be generated.
%C The least integer producing an infinite cycle is n=4: {4, 9, 16, 52, 88, 630, 1931, 1031, 2908, 53102, ...}.
%H <a href="/index/Per#perm">Index entries for sequences related to permutations</a>
%e The partition associated with 24 is found as follows (see A226062):
%e Write 24 in binary as 11000; the run lengths are 2,3.
%e Now subtract 1 from all but the last integer, giving 1,3.
%e Now reverse to 3,1; take running sum giving 3,4 and reverse again to partition {4,3};
%e Finally, note that {4,3} is the 5th partition of 7, and the 34th partition overall.
%e This shows that a(24)=34.
%t << Combinatorica`; rankpartition[(p_)?PartitionQ] := PartitionsP[Tr[p]] -Sum[(NumberOfPartitions[Tr[#1], First[#1]-1]& )[Drop[p,k]],
%t {k,0,Length[p]-1}]; rankpartition[par_?PartitionQ,All]:=Tr[PartitionsP[Range[Tr[par]-1]]]+rankpartition[par];
%t int2par[n_Integer]:=Block[{t0,t1,t2},t0=Length/@Split[IntegerDigits[n,2]];t1=Reverse@MapAt[#+1&,-1+t0,-1];t2=FoldList[Plus,First[t1], Rest[t1]];Reverse[t2]];
%t a=Table[ rankpartition[#,All]& @ int2par[n],{n,138}]
%Y Cf. A226062.
%K nonn
%O 1,2
%A _Wouter Meeussen_, Sep 14 2013
|