OFFSET
1,2
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..6561
FORMULA
a(n) <= n with equality iff n belongs to A032924.
EXAMPLE
The first terms, in decimal and in base 3, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
1 1 1 1
2 2 2 2
3 1 10 1
4 4 11 11
5 5 12 12
6 2 20 2
7 7 21 21
8 8 22 22
9 1 100 1
10 4 101 11
11 5 102 12
12 4 110 11
13 13 111 111
14 14 112 112
15 5 120 12
MATHEMATICA
a[n_] := FromDigits[DeleteCases[IntegerDigits[n, 3], 0], 3]; Array[a, 100] (* Amiram Eldar, Oct 31 2021 *)
PROG
(PARI) a(n, base=3) = fromdigits(select(sign, digits(n, base)), base)
(Python)
from gmpy2 import digits
def A348706(n): return int(digits(n, 3).replace('0', ''), 3) # Chai Wah Wu, Nov 02 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Oct 30 2021
STATUS
approved