%I #10 Mar 16 2019 19:11:45
%S 2,7,16,20,32,43,61,103,124,146,182,196,292,302,338,367,421,547,601,
%T 859,913,1039,1096,1172,1280,1312,1600,1640,1748,1816,2560,2624,2732,
%U 2776,3064,3092,3200,3283,3445,3823,3985,4759,4921,5299,5461,7663,7825,8203
%N In balanced ternary notation, zerofree non-repdigit numbers that are either palindromes or sign reversed palindromes.
%C Zerofree numbers in balanced ternary notation can be used as reversible sign operators. This sequence collects such operators that are either in palindrome form or sign reversed palindrome form (which is defined as (n)_bt+Reverse((n)_bt)=0).
%H Lei Zhou, <a href="/A233580/b233580.txt">Table of n, a(n) for n = 1..10000</a>
%e 2 = (1T)_bt in balanced ternary notation, where we use T to represent -1.
%e 1T + T1 = 0, matches the definition of sign reversed palindrome form. So 2 is in the sequence.
%e Other examples:
%e 7 = (1T1_bt) - palindrome; in the sequence.
%e 13 = (111)_bt - palindrome but repdigit; not in the sequence.
%e 16 = (1TT1)_bt - palindrome; in the sequence.
%e ...
%e 52 = (1T0T1)_bt - palindrome but not zerofree; not in the sequence.
%t BTDigits[m_Integer, g_] :=
%t (* This is to determine digits of a number in balanced ternary notation. *)
%t Module[{n = m, d, sign, t = g}, If[n != 0, If[n > 0, sign = 1,
%t 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];
%t BTnum[g_]:=Module[{bo=Reverse[g],data=0,i},Do[data=data+3^(i-1)*bo[[i]],{i,1,Length[bo]}];data];
%t ct=0;n=0;dg=0;spool={};res={};While[ct<50,n++; nbits = BTDigits[n, {0}];cdg=Length[nbits];If[cdg>dg,If[Length[spool]>0,Do[bits=spool[[j]];If[!MemberQ[bits,0],rb=Reverse[bits]; sign=rb[[1]];bo=Join[bits,-sign*rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]];bo=Join[bits,sign*rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]]],{j,1,Length[spool]}];Do[bits=spool[[j]];If[!MemberQ[bits,0],rb=Reverse[bits];bo=Join[bits,{-1},rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]];bo=Join[bits,{1},rb];If[MemberQ[bo,-1],data=BTnum[bo];ct++;AppendTo[res,data]]],{j,1,Length[spool]}];spool={};dg=cdg]];AppendTo[spool,nbits]];Print[res]
%Y Cf. A002113, A061917, A006995, A057890, A134027, A233010, A233571, A233572.
%K nonn,base,easy
%O 1,1
%A _Lei Zhou_, Dec 14 2013
|