login
Inverse permutation to A309668.
2

%I #9 Apr 23 2020 20:45:51

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

%T 37,36,35,34,33,32,31,30,29,28,27,53,26,50,49,24,47,46,45,44,43,42,41,

%U 81,79,39,76,75,74,72,71,70,69,68,67,66,65,64,63,62,61

%N Inverse permutation to A309668.

%H Robert Israel, <a href="/A309734/b309734.txt">Table of n, a(n) for n = 1..10000</a>

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

%e A309668(5) = 3, hence a(3) = 5.

%p S:= [$1..100]:

%p for n from 1 while S <> [] do

%p for i from 1 to nops(S) do

%p s:= S[i];

%p if ilog2(n*s+n-1) > ilog2(n*s-1) then

%p A[s]:= n;

%p S:= subsop(i=NULL,S);

%p break

%p fi

%p od od:

%p seq(A[i],i=1..100); # _Robert Israel_, Apr 23 2020

%Y Cf. A309668.

%K nonn,base,look

%O 1,2

%A _Rémy Sigrist_, Aug 14 2019