A353623 a(n) is the least k > 0 such that n and k*n can be added without carries in balanced ternary.
1, 2, 3, 2, 2, 6, 3, 3, 2, 2, 2, 5, 2, 2, 6, 6, 5, 3, 3, 3, 3, 3, 6, 2, 2, 3, 2, 2, 2, 3, 2, 2, 9, 5, 12, 2, 2, 2, 12, 2, 2, 6, 6, 12, 11, 6, 6, 14, 5, 9, 8, 3, 3, 3, 3, 3, 3, 3, 9, 11, 3, 3, 3, 3, 3, 14, 6, 6, 2, 2, 9, 2, 2, 2, 3, 3, 6, 2, 2, 3, 2, 2, 2, 3, 2
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.
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 (k)))
Formula
a(n) = A353624(n) / n for any n > 0.
a(3*n) = a(n).
Comments