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.

A362089 The base-3 expansion of a(n) is obtained by inserting a zero before each nonzero digit of the base-3 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 10, 11, 6, 19, 20, 9, 28, 29, 30, 91, 92, 33, 100, 101, 18, 55, 56, 57, 172, 173, 60, 181, 182, 27, 82, 83, 84, 253, 254, 87, 262, 263, 90, 271, 272, 273, 820, 821, 276, 829, 830, 99, 298, 299, 300, 901, 902, 303, 910, 911, 54, 163, 164, 165, 496
Offset: 0

Views

Author

Rémy Sigrist, Apr 08 2023

Keywords

Comments

This sequence is a permutation of A328727.

Examples

			The first terms, in decimal 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    10      11        101
   5    11      12        102
   6     6      20         20
   7    19      21        201
   8    20      22        202
   9     9     100        100
  10    28     101       1001
  11    29     102       1002
  12    30     110       1010
		

Crossrefs

Cf. A007089 (ter(n)), A048678, A328727, A362090.

Programs

  • PARI
    a(n) = { if (n==0, 0, n%3, 9*a(n\3) + n%3, 3*a(n/3)); }
    
  • Python
    from gmpy2 import digits
    def A362089(n): return int(digits(n,3).replace('1','01').replace('2','02'),3)
    # Chai Wah Wu, Apr 12 2023