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-1 of 1 results.

A353649 Lexicographically earliest sequence of distinct nonnegative integers such that two consecutive terms can be added without carries in balanced ternary.

Original entry on oeis.org

0, 1, 2, 6, 3, 5, 4, 8, 15, 9, 14, 10, 17, 7, 18, 11, 16, 12, 19, 50, 13, 23, 45, 24, 44, 25, 47, 27, 41, 28, 42, 26, 43, 29, 46, 30, 51, 20, 52, 21, 53, 22, 54, 31, 59, 153, 32, 48, 33, 49, 35, 55, 36, 56, 34, 57, 37, 68, 39, 69, 38, 70, 134, 40, 71, 132, 72
Offset: 0

Views

Author

Rémy Sigrist, May 01 2022

Keywords

Comments

Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.
This sequence is a permutation of the nonnegative integers with inverse A353650.

Examples

			The first terms, in decimal and in balanced ternary, are:
  n   a(n)  bter(a(n))
  --  ----  ----------
   0     0           0
   1     1           1
   2     2          1T
   3     6         1T0
   4     3          10
   5     5         1TT
   6     4          11
   7     8         10T
   8    15        1TT0
   9     9         100
  10    14        1TTT
  11    10         101
  12    17        1T0T
  13     7         1T1
  14    18        1T00
		

Crossrefs

Cf. A059095, A109812 (binary analog), A353648, A353650 (inverse).

Programs

  • PARI
    ok(u, v) = { while (u && v, my (uu=[0, +1, -1][1+u%3], vv=[0, +1, -1][1+v%3]); if (abs(uu+vv)>1, return (0)); u=(u-uu)/3; v=(v-vv)/3); 1 }
    { s=0; v=0; for (n=0, 66, print1 (v", "); s+=2^v; for (w=0, oo, if (!bittest(s,w) && ok(v,w), v=w; break))) }
Showing 1-1 of 1 results.