login
Inverse permutation to A102568.
4

%I #9 May 03 2023 14:25:19

%S 1,2,4,3,5,6,8,9,11,12,14,7,15,16,18,10,19,20,22,13,23,24,26,27,29,30,

%T 32,17,33,34,36,37,39,40,42,21,43,44,46,47,49,50,52,25,53,54,56,28,57,

%U 58,60,31,61,62,64,65,67,68,70,35,71,72,74,38,75,76,78,41,79,80,82,83

%N Inverse permutation to A102568.

%C A102571(n) = a(a(n)).

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

%t nt = 100; (* number of output terms *)

%t nmax = 150; (* needed length of A102568 *)

%t A102568 = Nest[Append[#, If[#[[-1]] == #[[-2]]+1, 2 #[[-1]], Min[Complement[Range[Max[#]+1], #]]]]&, {1, 2}, nmax];

%t Do[a[A102568[[n]]] = n, {n, 1, nmax}];

%t Table[a[n], {n, 1, nt}] (* _Jean-François Alcover_, May 03 2023, after _Ivan Neretin_ for A102568 *)

%K nonn

%O 1,2

%A _Reinhard Zumkeller_, Jan 15 2005