OFFSET
0,3
COMMENTS
This sequence is a permutation of A328727.
EXAMPLE
The first terms, in decimal and in base-3, 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 10 11 101
5 11 12 102
6 6 20 20
7 19 21 201
8 20 22 202
9 9 100 100
10 28 101 1001
11 29 102 1002
12 30 110 1010
PROG
(PARI) a(n) = { if (n==0, 0, n%3, 9*a(n\3) + n%3, 3*a(n/3)); }
(Python)
from gmpy2 import digits
def A362089(n): return int(digits(n, 3).replace('1', '01').replace('2', '02'), 3)
# Chai Wah Wu, Apr 12 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Apr 08 2023
STATUS
approved