OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers with inverse A353825.
A number is a fixed point of this sequence iff it has at most one digit 2 in its ternary expansion, that digit 2 being its rightmost nonzero digit.
LINKS
FORMULA
a(3*n) = 3*a(n).
EXAMPLE
The first terms, in decimal and in ternary, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 2 2 2
3 3 10 10
4 4 11 11
5 5 12 12
6 6 20 20
7 8 21 22
8 7 22 21
9 9 100 100
10 10 101 101
11 11 102 102
12 12 110 110
PROG
(PARI) a(n) = { my (d=digits(n, 3), p=1); for (k=1, #d, if (d[k], d[k]=p*=d[k])); fromdigits(d%3, 3) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, May 08 2022
STATUS
approved