A069024 Numbers that are palindromic in base 2 as well as in base 10 (initial zeros may be prepended).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 33, 40, 60, 66, 80, 90, 99, 252, 272, 292, 313, 330, 585, 626, 660, 717, 990, 2112, 2720, 2772, 2920, 4224, 5850, 6336, 7447, 7470, 8448, 8580, 9009, 15351, 21120, 22122, 25752, 32223, 39993, 40904, 42240, 44244, 48384
Offset: 1
Examples
66 in base 2 is 1000010, which is palindromic if rewritten as 01000010.
Links
- Robert Israel, Table of n, a(n) for n = 1..243
Programs
-
Maple
nextpal:= proc(p,d,V,b) local i,i2,pp,m,m2; pp:=p; V[1]:= V[1]+1; m2:= floor(d/2); i2:= ceil(d/2); if d::odd then pp:= pp + b^m2 else pp:= pp + b^m2 + b^(m2-1) fi; for i from 1 while V[i] = b do V[i]:= 0: if i = i2 then if d::even then ArrayTools:-Extend(V,[1],inplace); return b^d+1, d+1, V else V[i2]:= 1; return b^d+1, d+1, V; fi; fi; V[i+1]:= V[i+1]+1; if (d::odd and i=1) then pp:= pp + b^(i2-i-1) else pp:= pp + b^(i2-i-1) - b^(i2-i+1) fi; od; return pp, d, V end proc: count:= 1: S:= 0: p2[0]:=1: V2[0]:= <1>: d2[0]:= 1:m2:= 0: p10[0]:= 1: V10[0]:= <1>: d10[0]:= 1: m10:= 0: while count < 100 do i2:= min[index]([seq(p2[i],i=0..m2)])-1; p2o:= p2[i2]; i10:= min[index]([seq(p10[i],i=0..m10)])-1; p10o:= p10[i10]; if p2o = p10o then S:= S, p2o; count:= count+1; fi; if p2o <= p10o then x, d2[i2], V2[i2]:= nextpal(p2o/2^i2, d2[i2], V2[i2],2); p2[i2]:= 2^i2 *x; if i2 = m2 then m2:= m2+1; p2[m2]:= 2^m2; V2[m2]:= <1>; d2[m2]:= 1; fi; else x, d10[i10], V10[i10]:= nextpal(p10o/10^i10, d10[i10], V10[i10],10); p10[i10]:= 10^i10 * x; if i10 = m10 then m10:= m10+1; p10[m10]:= 10^m10; V10[m10]:= <1>; d10[m10]:= 1 fi fi od: S; # Robert Israel, Apr 01 2024
-
Mathematica
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]&]
Extensions
Edited by Dean Hickerson, Apr 06 2002
0 inserted by Sean A. Irvine, Mar 29 2024