login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A338243
a(0) = 0, a(n) = A338241(2*n-1) for any n > 0.
3
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, 15, 14, 28, 30, 29, 31, 36, 35, 34, 33, 32, 37, 39, 38, 40, 81, 80, 79, 78, 77, 73, 75, 74, 76, 72, 71, 70, 69, 68, 55, 57, 56, 58, 63, 62, 61, 60, 59, 64, 66, 65, 67
OFFSET
0,3
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
EXAMPLE
a(7) = A338241(13) = 7.
PROG
(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)) }
a(n) = if (n==0, 0, b(2*n-1))
CROSSREFS
Sequence in context: A265356 A083164 A094962 * A338246 A368225 A371267
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Oct 18 2020
STATUS
approved