Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #7 Mar 16 2017 22:34:13
%S 1,3,5,7,9,11,15,17,19,21,23,25,27,29,33,35,43,45,47,49,51,53,55,57,
%T 59,61,63,65,69,71,73,75,77,79,81,83,87,89,95,97,99,101,105,107,113,
%U 127,129,133,135,137,139,141,143,145,147,151,153,155,157,159,161
%N Numbers such that the sum of trits of its balanced ternary representation is 1 or -1.
%H Lei Zhou, <a href="/A283800/b283800.txt">Table of n, a(n) for n = 1..10000</a>
%e 3 = 10 in balanced ternary (bt) notation, 1+0 = 1, so 3 is in the list;
%e ...
%e 11 = 11T in bt notation, 1+1+T = 1, here T represent -1, so 11 is in the list;
%e 13 = 111 in bt notation, 1+1+1 = 3, so 13 is NOT in the list.
%t BTDigits[m_Integer,
%t g_] :=(*This is to determine digits of a number in balanced \
%t ternary notation.*)
%t Module[{n = m, d, sign, t = g},
%t If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
%t d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
%t While[Length[t] < d, PrependTo[t, 0]];
%t t[[Length[t] + 1 - d]] = sign;
%t t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
%t n = 0; Table[While[n++; g = {}; bt = BTDigits[n, g]; s = Total[bt];
%t Abs[s] != 1]; n, {i, 1, 61}]
%Y Cf. A065303, A174658.
%K nonn,easy,base
%O 1,2
%A _Lei Zhou_, Mar 16 2017