login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A069024 Numbers that are palindromic in base 2 as well as in base 10 (initial zeros may be prepended). 1

%I #19 Apr 01 2024 20:10:41

%S 0,1,2,3,4,5,6,7,8,9,10,20,30,33,40,60,66,80,90,99,252,272,292,313,

%T 330,585,626,660,717,990,2112,2720,2772,2920,4224,5850,6336,7447,7470,

%U 8448,8580,9009,15351,21120,22122,25752,32223,39993,40904,42240,44244,48384

%N Numbers that are palindromic in base 2 as well as in base 10 (initial zeros may be prepended).

%H Robert Israel, <a href="/A069024/b069024.txt">Table of n, a(n) for n = 1..243</a>

%e 66 in base 2 is 1000010, which is palindromic if rewritten as 01000010.

%p nextpal:= proc(p,d,V,b)

%p local i,i2,pp,m,m2;

%p pp:=p;

%p V[1]:= V[1]+1;

%p m2:= floor(d/2);

%p i2:= ceil(d/2);

%p if d::odd then pp:= pp + b^m2 else pp:= pp + b^m2 + b^(m2-1) fi;

%p for i from 1 while V[i] = b do

%p V[i]:= 0:

%p if i = i2 then

%p if d::even then

%p ArrayTools:-Extend(V,[1],inplace);

%p return b^d+1, d+1, V

%p else

%p V[i2]:= 1;

%p return b^d+1, d+1, V;

%p fi;

%p fi;

%p V[i+1]:= V[i+1]+1;

%p if (d::odd and i=1) then pp:= pp + b^(i2-i-1) else

%p pp:= pp + b^(i2-i-1) - b^(i2-i+1) fi;

%p od;

%p return pp, d, V

%p end proc:

%p count:= 1:

%p S:= 0:

%p p2[0]:=1: V2[0]:= <1>: d2[0]:= 1:m2:= 0:

%p p10[0]:= 1: V10[0]:= <1>: d10[0]:= 1: m10:= 0:

%p while count < 100 do

%p i2:= min[index]([seq(p2[i],i=0..m2)])-1; p2o:= p2[i2];

%p i10:= min[index]([seq(p10[i],i=0..m10)])-1; p10o:= p10[i10];

%p if p2o = p10o then

%p S:= S, p2o; count:= count+1;

%p fi;

%p if p2o <= p10o then x, d2[i2], V2[i2]:= nextpal(p2o/2^i2, d2[i2], V2[i2],2); p2[i2]:= 2^i2 *x;

%p if i2 = m2 then m2:= m2+1; p2[m2]:= 2^m2; V2[m2]:= <1>; d2[m2]:= 1;

%p fi;

%p else

%p x, d10[i10], V10[i10]:= nextpal(p10o/10^i10, d10[i10], V10[i10],10);

%p p10[i10]:= 10^i10 * x;

%p if i10 = m10 then m10:= m10+1; p10[m10]:= 10^m10; V10[m10]:= <1>; d10[m10]:= 1

%p fi fi od:

%p S; # _Robert Israel_, Apr 01 2024

%t pal[n_, b_] := (z=IntegerDigits[n, b]) == Reverse[z]; extpal[n_, b_] := If[Mod[n, b]>0, pal[n, b], extpal[n/b, b]]; Select[Range[50000], extpal[ #, 10]&&extpal[ #, 2]&]

%Y Cf. A007632.

%Y Intersection of A061917 and A057890.

%K nonn,base

%O 1,3

%A _Amarnath Murthy_, Apr 02 2002

%E Edited by _Dean Hickerson_, Apr 06 2002

%E 0 inserted by _Sean A. Irvine_, Mar 29 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)