|
|
A066124
|
|
In base 2, three 'Reverse and Add' steps are needed to reach a palindrome.
|
|
1
|
|
|
44, 50, 54, 58, 72, 92, 98, 118, 154, 156, 184, 194, 206, 214, 216, 234, 242, 272, 296, 316, 364, 376, 386, 406, 466, 470, 478, 502, 564, 566, 570, 572, 626, 628, 634, 688, 690, 696, 716, 732, 748, 752, 770, 790, 798, 806, 814, 820, 822, 824, 854, 870, 880
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The analog of A065208 in base 2. The number of steps starts at 0, so palindromes (cf. A006995) are excluded.
|
|
LINKS
|
|
|
PROG
|
(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x%10; x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } baseI(x, b)= { local(d, e=0, f=1); while (x>0, d=x-10*(x\10); x\=10; e+=d*f; f*=b); return(e) } calcB(p)= { local(b, r); b=baseE(p, 2); r=Rev(b); d=baseI(r, 2) + p; b=baseE(d, 2); return(b); } { n=0; for (m=1, 10^9, d=m; t=1; b=baseE(d, 2); for (i=1, 3, if (Palin(b), t=0; break); b=calcB(d)); if (t && Palin(b), write("b066124.txt", n++, " ", m); if (n==1000, return)) ) } \\ Harry J. Smith, Feb 01 2010
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|