OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers with inverse A343601.
LINKS
FORMULA
EXAMPLE
The first terms, in base 10 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 4 11 11
5 7 12 21
6 6 20 20
7 5 21 12
8 8 22 22
9 9 100 100
10 12 101 110
11 21 102 210
12 10 110 101
13 13 111 111
14 16 112 121
PROG
(PARI) a(n, base=3) = { my (d=digits(n, base)); for (k=2, #d, if (d[k], return (fromdigits(concat(d[k..#d], d[1..k-1]), base)))); n }
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Apr 21 2021
STATUS
approved