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.

A343605 a(n) is the greatest number < n with the same sum of balanced ternary digits as n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 22 2021

Keywords

Comments

This sequence can be extended to negative indexes by setting a(-n) = -A343604(n) for any n > 0.

Examples

			The first terms, in base 10 and in balanced ternary (where T denotes the digit -1), alongside A065363(n), are:
  n   a(n)  bter(n)  bter(a(n))  A065363(n)
  --  ----  -------  ----------  ----------
   0    -2        0          T1           0
   1    -5        1         T11           1
   2     0       1T           0           0
   3     1       10           1           1
   4   -14       11        T111           2
   5    -1      1TT           T          -1
   6     2      1T0          1T           0
   7     3      1T1          10           1
   8     6      10T         1T0           0
   9     7      100         1T1           1
  10     4      101          11           2
  11     9      11T         100           1
  12    10      110         101           2
		

Crossrefs

Programs

  • PARI
    A065363(n) = { my (v=0, d); while (n, v+=d=centerlift(Mod(n,3)); n=(n-d)\3); v }
    a(n) = my (s=A065363(n)); forstep (k=n-1, -oo, -1, if (s==A065363(k), return (k)))

Formula

a(9*n) = 9*n - 2.
a(A174658(n+1)) = A174658(n) for any n > 0.
a(n) <= 0 iff n belongs to A003462 or to A007051.
a(A003462(k)) = -A007051(k + 1) for any k >= 0.
a(A007051(k)) = -A003462(k - 1) for any k > 0.