

A233571


In balanced ternary notation, reverse digits of a(n) equals to a(n).


5



0, 2, 8, 20, 26, 32, 56, 80, 104, 146, 164, 182, 224, 242, 260, 302, 320, 338, 416, 488, 560, 656, 728, 800, 896, 968, 1040, 1172, 1226, 1280, 1406, 1460, 1514, 1640, 1694, 1748, 1898, 1952, 2006, 2132, 2186, 2240, 2366, 2420, 2474, 2624, 2678, 2732, 2858
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

Lei Zhou, Table of n, a(n) for n = 1..10000


EXAMPLE

In balanced ternary notation, 8=(10T)_bt, where we use T to represent 1. Reverse digits of (10T)_bt is (T01)_bt = 8. So 8 is in this sequence.
Similarly, 2240 = (1001T00T)_bt, whose reverse digits is (T00T1001)_bt = 2240. So 2240 is in this sequence.


MATHEMATICA

BTDigits[m_Integer, g_] :=
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];
ct = 1; n = 0; m = 0; dg = 0; switch = 1; res = {0}; While[ct < 50, n++;
bits = BTDigits[n, {0}]; If[lb = Length[bits]; lb > dg,
If[switch == 0, n = m; switch = 1; OK = 0, dg = lb; m = n  1;
switch = 0; OK = 1], OK = 1]; If[OK == 1, rbt = Reverse[bits];
If[switch == 1, nb = Join[bits, {0}], nb = bits];
nb = Join[nb, rbt]; nb = Reverse[nb]; data = 0;
Do[data = data + 3^(i  1)*nb[[i]], {i, 1, Length[nb]}]; ct++;
AppendTo[res, data]]]; res


CROSSREFS

Cf. A002113, A061917, A006995, A057890, A134027, A233010
Sequence in context: A136904 A043002 A108180 * A192153 A190640 A230434
Adjacent sequences: A233568 A233569 A233570 * A233572 A233573 A233574


KEYWORD

nonn,easy,base


AUTHOR

Lei Zhou, Dec 13 2013


STATUS

approved



