login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A283800
Numbers such that the sum of trits of its balanced ternary representation is 1 or -1.
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,2
EXAMPLE
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.
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}]
CROSSREFS
Sequence in context: A275852 A300914 A204457 * A043325 A023692 A355743
KEYWORD
nonn,easy,base
AUTHOR
Lei Zhou, Mar 16 2017
STATUS
approved