cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A348706 Delete all 0's from ternary expansion of n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 30 2021

Keywords

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
		

Crossrefs

Cf. A004719 (decimal analog), A032924 (fixed points), A038573 (binary analog).

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.