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.
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
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.
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
- Wikipedia, Balanced ternary
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).
Comments