login
Inverse of permutation in A183209.
2

%I #14 Sep 04 2021 08:26:06

%S 1,2,3,5,4,9,7,6,17,13,10,11,33,8,25,19,18,21,65,14,15,49,12,37,35,34,

%T 41,129,26,27,29,20,97,23,22,73,69,66,67,81,16,257,51,50,53,57,38,39,

%U 193,36,45,43,42,145,137,130,131,133,28,161,31,30,513,101,98

%N Inverse of permutation in A183209.

%H Alois P. Heinz, <a href="/A259431/b259431.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>

%t b[n_] := b[n] = If[n==1, 1, If[EvenQ[n], 3b[n/2]-1, Floor[3b[(n+1)/2]/2]]];

%t a[n_] := Module[{k = 1}, While[n != b[k], k++]; k];

%t Array[a, 100] (* _Jean-François Alcover_, Sep 04 2021 *)

%o (Haskell)

%o import Data.List (elemIndex); import Data.Maybe (fromJust)

%o a259431 = (+ 1) . fromJust . (`elemIndex` a183209_list)

%o -- _Reinhard Zumkeller_, Jun 27 2015

%Y Cf. A183209.

%K nonn,look

%O 1,2

%A _Alois P. Heinz_, Jun 26 2015