A348706 Delete all 0's from ternary expansion of n.
1, 2, 1, 4, 5, 2, 7, 8, 1, 4, 5, 4, 13, 14, 5, 16, 17, 2, 7, 8, 7, 22, 23, 8, 25, 26, 1, 4, 5, 4, 13, 14, 5, 16, 17, 4, 13, 14, 13, 40, 41, 14, 43, 44, 5, 16, 17, 16, 49, 50, 17, 52, 53, 2, 7, 8, 7, 22, 23, 8, 25, 26, 7, 22, 23, 22, 67, 68, 23, 70, 71, 8, 25
Offset: 1
Examples
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
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..6561
Programs
-
Mathematica
a[n_] := FromDigits[DeleteCases[IntegerDigits[n, 3], 0], 3]; Array[a, 100] (* Amiram Eldar, Oct 31 2021 *)
-
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
Formula
a(n) <= n with equality iff n belongs to A032924.