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.

This page as a plain text file.
%I A348706 #13 Nov 02 2021 16:44:46
%S A348706 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,
%T A348706 13,14,5,16,17,4,13,14,13,40,41,14,43,44,5,16,17,16,49,50,17,52,53,2,
%U A348706 7,8,7,22,23,8,25,26,7,22,23,22,67,68,23,70,71,8,25
%N A348706 Delete all 0's from ternary expansion of n.
%H A348706 Rémy Sigrist, <a href="/A348706/b348706.txt">Table of n, a(n) for n = 1..6561</a>
%F A348706 a(n) <= n with equality iff n belongs to A032924.
%e A348706 The first terms, in decimal and in base 3, are:
%e A348706   n   a(n)  ter(n)  ter(a(n))
%e A348706   --  ----  ------  ---------
%e A348706    1     1       1          1
%e A348706    2     2       2          2
%e A348706    3     1      10          1
%e A348706    4     4      11         11
%e A348706    5     5      12         12
%e A348706    6     2      20          2
%e A348706    7     7      21         21
%e A348706    8     8      22         22
%e A348706    9     1     100          1
%e A348706   10     4     101         11
%e A348706   11     5     102         12
%e A348706   12     4     110         11
%e A348706   13    13     111        111
%e A348706   14    14     112        112
%e A348706   15     5     120         12
%t A348706 a[n_] := FromDigits[DeleteCases[IntegerDigits[n, 3], 0], 3]; Array[a, 100] (* _Amiram Eldar_, Oct 31 2021 *)
%o A348706 (PARI) a(n, base=3) = fromdigits(select(sign, digits(n, base)), base)
%o A348706 (Python)
%o A348706 from gmpy2 import digits
%o A348706 def A348706(n): return int(digits(n,3).replace('0',''),3) # _Chai Wah Wu_, Nov 02 2021
%Y A348706 Cf. A004719 (decimal analog), A032924 (fixed points), A038573 (binary analog).
%K A348706 nonn,base,easy
%O A348706 1,2
%A A348706 _Rémy Sigrist_, Oct 30 2021