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.

Showing 1-2 of 2 results.

A343317 a(n) is the least k >= 0 such that A343316(n, k) = n.

Original entry on oeis.org

0, 1, 4, 2, 4, 13, 11, 13, 7, 5, 7, 13, 11, 13, 40, 38, 40, 34, 32, 34, 40, 38, 40, 22, 20, 22, 16, 14, 16, 22, 20, 22, 40, 38, 40, 34, 32, 34, 40, 38, 40, 121, 119, 121, 115, 113, 115, 121, 119, 121, 103, 101, 103, 97, 95, 97, 103, 101, 103, 121, 119, 121
Offset: 0

Views

Author

Rémy Sigrist, Apr 11 2021

Keywords

Comments

To compute a(n): in the balanced ternary representation of n, replace each nonzero digit by "+1" and each nonleading zero by "-1".

Examples

			The first terms, alongside their balanced ternary representation (with "T" instead of digits "-1"), are:
  n   a(n)  bter(n)  bter(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     1        1           1
   2     4       1T          11
   3     2       10          1T
   4     4       11          11
   5    13      1TT         111
   6    11      1T0         11T
   7    13      1T1         111
   8     7      10T         1T1
   9     5      100         1TT
  10     7      101         1T1
  11    13      11T         111
  12    11      110         11T
  13    13      111         111
  14    40     1TTT        1111
  15    38     1TT0        111T
		

Crossrefs

Programs

  • PARI
    a(n) = if (n==0, 0, my (d=centerlift(Mod(n, 3))); if (d, +1, -1) + 3*a((n-d)\3))

A343836 Array T(n, k), n, k > 0, read by antidiagonals; the balanced ternary representation of T(n, k) is obtained by adding componentwise (i.e., without carries) the digits in the balanced ternary representations of n and of k.

Original entry on oeis.org

0, 1, 1, 2, -1, 2, 3, 3, 3, 3, 4, 4, -2, 4, 4, 5, 2, -4, -4, 2, 5, 6, 6, -3, -3, -3, 6, 6, 7, 7, 10, -2, -2, 10, 7, 7, 8, 5, 8, 8, -4, 8, 8, 5, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 13, 10, 10, -5, 10, 10, 13, 10, 10, 11, 8, 11, 11, 8, -7, -7, 8, 11, 11, 8, 11
Offset: 0

Views

Author

Rémy Sigrist, May 01 2021

Keywords

Comments

This sequence is similar to A003987 and to A004489.
We use the following table to combine individual digits (this is the balanced ternary addition table read mod 3):
| T 0 1
---+-------
T | 1 T 0
0 | T 0 1
1 | 0 1 T

Examples

			Array T(n, k) begins:
  n\k|   0   1   2   3   4    5    6    7    8    9   10   11   12   13
  ---+-----------------------------------------------------------------
    0|   0   1   2   3   4    5    6    7    8    9   10   11   12   13
    1|   1  -1   3   4   2    6    7    5    9   10    8   12   13   11
    2|   2   3  -2  -4  -3   10    8    9   13   11   12    7    5    6
    3|   3   4  -4  -3  -2    8    9   10   11   12   13    5    6    7
    4|   4   2  -3  -2  -4    9   10    8   12   13   11    6    7    5
    5|   5   6  10   8   9   -5   -7   -6  -11  -13  -12   -8  -10   -9
    6|   6   7   8   9  10   -7   -6   -5  -13  -12  -11  -10   -9   -8
    7|   7   5   9  10   8   -6   -5   -7  -12  -11  -13   -9   -8  -10
    8|   8   9  13  11  12  -11  -13  -12   -8  -10   -9   -5   -7   -6
    9|   9  10  11  12  13  -13  -12  -11  -10   -9   -8   -7   -6   -5
   10|  10   8  12  13  11  -12  -11  -13   -9   -8  -10   -6   -5   -7
   11|  11  12   7   5   6   -8  -10   -9   -5   -7   -6  -11  -13  -12
   12|  12  13   5   6   7  -10   -9   -8   -7   -6   -5  -13  -12  -11
   13|  13  11   6   7   5   -9   -8  -10   -6   -5   -7  -12  -11  -13
Array T(n, k) begins in balanced ternary:
  n\k|    0    1   1T   10   11  1TT  1T0  1T1  10T  100  101  11T  110  111
  ---+----------------------------------------------------------------------
    0|    0    1   1T   10   11  1TT  1T0  1T1  10T  100  101  11T  110  111
    1|    1    T   10   11   1T  1T0  1T1  1TT  100  101  10T  110  111  11T
   1T|   1T   10   T1   TT   T0  101  10T  100  111  11T  110  1T1  1TT  1T0
   10|   10   11   TT   T0   T1  10T  100  101  11T  110  111  1TT  1T0  1T1
   11|   11   1T   T0   T1   TT  100  101  10T  110  111  11T  1T0  1T1  1TT
  1TT|  1TT  1T0  101  10T  100  T11  T1T  T10  TT1  TTT  TT0  T01  T0T  T00
  1T0|  1T0  1T1  10T  100  101  T1T  T10  T11  TTT  TT0  TT1  T0T  T00  T01
  1T1|  1T1  1TT  100  101  10T  T10  T11  T1T  TT0  TT1  TTT  T00  T01  T0T
  10T|  10T  100  111  11T  110  TT1  TTT  TT0  T01  T0T  T00  T11  T1T  T10
  100|  100  101  11T  110  111  TTT  TT0  TT1  T0T  T00  T01  T1T  T10  T11
  101|  101  10T  110  111  11T  TT0  TT1  TTT  T00  T01  T0T  T10  T11  T1T
  11T|  11T  110  1T1  1TT  1T0  T01  T0T  T00  T11  T1T  T10  TT1  TTT  TT0
  110|  110  111  1TT  1T0  1T1  T0T  T00  T01  T1T  T10  T11  TTT  TT0  TT1
  111|  111  11T  1T0  1T1  1TT  T00  T01  T0T  T10  T11  T1T  TT0  TT1  TTT
		

Crossrefs

Programs

  • PARI
    T(n,k,c=v->centerlift(Mod(v,3))) = { if (n==0 && k==0, return (0), my (d=c(n), t=c(k)); c(d+t)+3*T((n-d)/3, (k-t)/3)) }

Formula

T(n, k) = T(k, n).
T(m, T(n, k)) = T(T(m, n), k).
T(n, 0) = n.
T(n, n) = -n.
Showing 1-2 of 2 results.