login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Inverse permutation of the sequence of positive integers at A232559.
5

%I #9 Sep 14 2021 14:59:43

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

%T 37,22,35,34,55,20,32,31,50,30,48,47,76,28,45,44,71,43,69,68,110,25,

%U 40,39,63,38,61,60,97,36,58,57,92,56,90,89,144,33,53,52

%N Inverse permutation of the sequence of positive integers at A232559.

%H Alois P. Heinz, <a href="/A232560/b232560.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Clark Kimberling)

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

%p g:= proc() local l, s; l, s:= [1], {1}:

%p proc(n) option remember; local i, r; r:= l[1];

%p l:= subsop(1=NULL, l);

%p for i in [1+r, r+r] do if not i in s then

%p l, s:=[l[], i], s union {i} fi

%p od; r

%p end

%p end():

%p a:= proc() local t, a; t, a:= 0, proc() -1 end;

%p proc(n) local h;

%p while a(n) < 0 do

%p t:= t+1; h:= g(t);

%p if a(h) < 0 then a(h):= t fi

%p od; a(n)

%p end

%p end():

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Sep 14 2021

%t z = 12; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1]]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]] (* A232559 *)

%t Table[Length[g1[n]], {n, 1, z}] (* Fibonacci numbers *)

%t t1 = Flatten[Table[Position[t, n], {n, 1, 200}]] (* A232560 *)

%Y Cf. A232559, A000045.

%K nonn,easy

%O 1,2

%A _Clark Kimberling_, Nov 26 2013