cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A265559 #9 Feb 25 2024 12:40:10
%S A265559 0,1,11,11,101,101,111,111,1001,1001,1111,1111,1111,1111,1111,1111,
%T A265559 10001,10001,10101,10101,10101,10101,11011,11011,11011,11011,11011,
%U A265559 11011,11111,11111,11111,11111,100001,100001,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,101101,110011
%N A265559 Smallest base-2 palindrome m >= n, written in base 2.
%p A265559 ispal:= proc(n) global b; # test if n is base-b pallindrome
%p A265559   local L, Ln, i;
%p A265559   L:= convert(n, base, b);
%p A265559   Ln:= nops(L);
%p A265559 for i from 1 to floor(Ln/2) do
%p A265559 if L[i] <> L[Ln+1-i] then return(false); fi;
%p A265559 od:
%p A265559 return(true);
%p A265559 end proc;
%p A265559 # find min pal >= n, write in base 10
%p A265559 big10:=proc(n) global b;
%p A265559 local t1,t2,i,m,sw1,L1;
%p A265559 t1:=convert(n,base,b);
%p A265559 L1:=nops(t1);
%p A265559 for m from n to 10*n do
%p A265559 if ispal(m) then return(m); fi;
%p A265559                        od;
%p A265559 lprint("no solution in big10 for n = ", n);
%p A265559 end proc;
%p A265559 # find min pal >= n, write in base 10
%p A265559 bigb:=proc(n) global b;
%p A265559 local t1,t2,i,m,mb,sw1,L1;
%p A265559 t1:=convert(n,base,b);
%p A265559 L1:=nops(t1);
%p A265559 for m from n to 10*n do
%p A265559 if ispal(m) then t2:=convert(m,base,b); mb:=add(t2[i]*10^(i-1), i=1..nops(t2)); return(mb); fi;
%p A265559                        od;
%p A265559 lprint("no solution in big10 for n = ", n);
%p A265559 end proc;
%p A265559 b:=2;
%p A265559 [seq(big10(n),n=0..144)]; # A206914
%p A265559 [seq(bigb(n),n=0..144)]; # A265559
%t A265559 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 A265559 Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
%Y A265559 See A206914 for the values of m written in base 10.
%K A265559 nonn,base
%O A265559 0,3
%A A265559 _N. J. A. Sloane_, Dec 10 2015