login
a(0) = 0, a(n) = A338241(2*n-1) for any n > 0.
3

%I #9 Oct 18 2020 22:32:47

%S 0,1,3,2,4,9,8,7,6,5,10,12,11,13,27,26,25,24,23,19,21,20,22,18,17,16,

%T 15,14,28,30,29,31,36,35,34,33,32,37,39,38,40,81,80,79,78,77,73,75,74,

%U 76,72,71,70,69,68,55,57,56,58,63,62,61,60,59,64,66,65,67

%N a(0) = 0, a(n) = A338241(2*n-1) for any n > 0.

%C This sequence is a self-inverse permutation of the nonnegative integers.

%H Rémy Sigrist, <a href="/A338243/b338243.txt">Table of n, a(n) for n = 0..6560</a>

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

%e a(7) = A338241(13) = 7.

%o (PARI) b(n) = { if (n==0, return (0), my (d=n%3, m=n\3); if (d==0, 3*b(m), d==1, 1-3*b(m), 3*b(m)-1)) }

%o a(n) = if (n==0, 0, b(2*n-1))

%Y Cf. A338241, A338242.

%K nonn

%O 0,3

%A _Rémy Sigrist_, Oct 18 2020