A233580 In balanced ternary notation, zerofree non-repdigit numbers that are either palindromes or sign reversed palindromes.
2, 7, 16, 20, 32, 43, 61, 103, 124, 146, 182, 196, 292, 302, 338, 367, 421, 547, 601, 859, 913, 1039, 1096, 1172, 1280, 1312, 1600, 1640, 1748, 1816, 2560, 2624, 2732, 2776, 3064, 3092, 3200, 3283, 3445, 3823, 3985, 4759, 4921, 5299, 5461, 7663, 7825, 8203
Offset: 1
Examples
2 = (1T)_bt in balanced ternary notation, where we use T to represent -1. 1T + T1 = 0, matches the definition of sign reversed palindrome form. So 2 is in the sequence. Other examples: 7 = (1T1_bt) - palindrome; in the sequence. 13 = (111)_bt - palindrome but repdigit; not in the sequence. 16 = (1TT1)_bt - palindrome; in the sequence. ... 52 = (1T0T1)_bt - palindrome but not zerofree; not in the sequence.
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]; BTnum[g_]:=Module[{bo=Reverse[g],data=0,i},Do[data=data+3^(i-1)*bo[[i]],{i,1,Length[bo]}];data]; 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]
Comments