A283800 Numbers such that the sum of trits of its balanced ternary representation is 1 or -1.
1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25, 27, 29, 33, 35, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 69, 71, 73, 75, 77, 79, 81, 83, 87, 89, 95, 97, 99, 101, 105, 107, 113, 127, 129, 133, 135, 137, 139, 141, 143, 145, 147, 151, 153, 155, 157, 159, 161
Offset: 1
Examples
3 = 10 in balanced ternary (bt) notation, 1+0 = 1, so 3 is in the list; ... 11 = 11T in bt notation, 1+1+T = 1, here T represent -1, so 11 is in the list; 13 = 111 in bt notation, 1+1+1 = 3, so 13 is NOT in the list.
Links
- Lei Zhou, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
BTDigits[m_Integer, g_] :=(*This is to determine digits of a number in balanced \ ternary notation.*) Module[{n = m, d, sign, t = g}, If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n]; d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++]; While[Length[t] < d, PrependTo[t, 0]]; t[[Length[t] + 1 - d]] = sign; t = BTDigits[sign*(n - 3^(d - 1)), t]]; t]; n = 0; Table[While[n++; g = {}; bt = BTDigits[n, g]; s = Total[bt]; Abs[s] != 1]; n, {i, 1, 61}]