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!)
A265559 Smallest base-2 palindrome m >= n, written in base 2. 1

%I #9 Feb 25 2024 12:40:10

%S 0,1,11,11,101,101,111,111,1001,1001,1111,1111,1111,1111,1111,1111,

%T 10001,10001,10101,10101,10101,10101,11011,11011,11011,11011,11011,

%U 11011,11111,11111,11111,11111,100001,100001,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,110011

%N Smallest base-2 palindrome m >= n, written in base 2.

%p ispal:= proc(n) global b; # test if n is base-b pallindrome

%p local L, Ln, i;

%p L:= convert(n, base, b);

%p Ln:= nops(L);

%p for i from 1 to floor(Ln/2) do

%p if L[i] <> L[Ln+1-i] then return(false); fi;

%p od:

%p return(true);

%p end proc;

%p # find min pal >= n, write in base 10

%p big10:=proc(n) global b;

%p local t1,t2,i,m,sw1,L1;

%p t1:=convert(n,base,b);

%p L1:=nops(t1);

%p for m from n to 10*n do

%p if ispal(m) then return(m); fi;

%p od;

%p lprint("no solution in big10 for n = ", n);

%p end proc;

%p # find min pal >= n, write in base 10

%p bigb:=proc(n) global b;

%p local t1,t2,i,m,mb,sw1,L1;

%p t1:=convert(n,base,b);

%p L1:=nops(t1);

%p for m from n to 10*n do

%p if ispal(m) then t2:=convert(m,base,b); mb:=add(t2[i]*10^(i-1), i=1..nops(t2)); return(mb); fi;

%p od;

%p lprint("no solution in big10 for n = ", n);

%p end proc;

%p b:=2;

%p [seq(big10(n),n=0..144)]; # A206914

%p [seq(bigb(n),n=0..144)]; # A265559

%t b2pal[n_]:=Module[{m=n},While[IntegerDigits[m,2]!=Reverse[IntegerDigits[m,2]],m++]; FromDigits[ IntegerDigits[m,2]]]; Array[b2pal,50,0] (* _Harvey P. Dale_, Feb 25 2024 *)

%Y Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.

%Y See A206914 for the values of m written in base 10.

%K nonn,base

%O 0,3

%A _N. J. A. Sloane_, Dec 10 2015

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 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)