OFFSET
0,2
COMMENTS
This sequence is a self-inverse permutation of the nonnegative integers.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..6560
Rémy Sigrist, PARI program
FORMULA
a(n) = n iff n belongs to A039001.
a(n) < 3^k iff n < 3^k.
EXAMPLE
The first terms, alongside their ternary expansions, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 2 1 2
2 1 2 1
3 6 10 20
4 8 11 22
5 5 12 12
6 3 20 10
7 7 21 21
8 4 22 11
9 17 100 122
10 20 101 202
11 11 102 102
12 24 110 220
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 05 2022
STATUS
approved