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.

A353624 a(0) = 0, and for n > 0, a(n) is the least multiple of n that can be added to n without carries in balanced ternary.

Original entry on oeis.org

0, 2, 6, 6, 8, 30, 18, 21, 16, 18, 20, 55, 24, 26, 84, 90, 80, 51, 54, 57, 60, 63, 132, 46, 48, 75, 52, 54, 56, 87, 60, 62, 288, 165, 408, 70, 72, 74, 456, 78, 80, 246, 252, 516, 484, 270, 276, 658, 240, 441, 400, 153, 156, 159, 162, 165, 168, 171, 522, 649
Offset: 0

Views

Author

Rémy Sigrist, Apr 30 2022

Keywords

Comments

Two integers can be added without carries in balanced ternary if they have no equal nonzero digit at the same position.

Examples

			For n = 5:
- we consider the following cases:
      k  bter(k*5)  carries?
      -  ---------  --------
      1        1TT  yes
      2        101  yes
      3       1TT0  yes
      4       1T1T  yes
      5       10T1  yes
      6       1010  no
- so a(5) = 6*5 = 30.
		

Crossrefs

Cf. A059095, A261892 (binary analog), A353623.

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); return (1) }
    a(n) = for (k=1, oo, if (ok(n, n*k), return (n*k)))

Formula

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