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.

A353828 The positions of nonzero digits in the balanced ternary expansions of n and a(n) are the same, and the k-th leftmost nonzero digit in a(n) equals the product of the k leftmost nonzero digits in n.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 11, 12, 13, 20, 21, 22, 19, 18, 17, 16, 15, 14, 25, 24, 23, 26, 27, 28, 29, 30, 31, 34, 33, 32, 35, 36, 37, 38, 39, 40, 61, 60, 59, 62, 63, 64, 65, 66, 67, 56, 57, 58, 55, 54, 53, 52, 51, 50, 47, 48, 49, 46, 45, 44, 43, 42, 41
Offset: 0

Views

Author

Rémy Sigrist, May 08 2022

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A353829.
A number is a fixed point of this sequence iff it has at most one digit -1 in its balanced ternary expansion, that digit -1 being its rightmost nonzero digit.

Examples

			The first terms, in decimal and in balanced ternary, are:
  n   a(n)  bter(n)  bter(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     1        1           1
   2     2       1T          1T
   3     3       10          10
   4     4       11          11
   5     7      1TT         1T1
   6     6      1T0         1T0
   7     5      1T1         1TT
   8     8      10T         10T
   9     9      100         100
  10    10      101         101
  11    11      11T         11T
  12    12      110         110
		

Crossrefs

See A305458, A353824, A353826, A353830 for similar sequences.
Cf. A353829 (inverse).

Programs

  • PARI
    a(n) = {
        my (d=[], t, p=1);
        while (n, d=concat(t=[0,1,-1][1+n%3], d); n=(n-t)/3);
        for (k=1, #d, if (d[k], d[k]=p*=d[k]));
        fromdigits(d,3);
    }

Formula

a(3*n) = 3*a(n).