Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A265559
Smallest base-2 palindrome m >= n, written in base 2.
1
0, 1, 11, 11, 101, 101, 111, 111, 1001, 1001, 1111, 1111, 1111, 1111, 1111, 1111, 10001, 10001, 10101, 10101, 10101, 10101, 11011, 11011, 11011, 11011, 11011, 11011, 11111, 11111, 11111, 11111, 100001, 100001, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 101101, 110011
OFFSET
0,3
MAPLE
ispal:= proc(n) global b; # test if n is base-b pallindrome
local L, Ln, i;
L:= convert(n, base, b);
Ln:= nops(L);
for i from 1 to floor(Ln/2) do
if L[i] <> L[Ln+1-i] then return(false); fi;
od:
return(true);
end proc;
# find min pal >= n, write in base 10
big10:=proc(n) global b;
local t1, t2, i, m, sw1, L1;
t1:=convert(n, base, b);
L1:=nops(t1);
for m from n to 10*n do
if ispal(m) then return(m); fi;
od;
lprint("no solution in big10 for n = ", n);
end proc;
# find min pal >= n, write in base 10
bigb:=proc(n) global b;
local t1, t2, i, m, mb, sw1, L1;
t1:=convert(n, base, b);
L1:=nops(t1);
for m from n to 10*n do
if ispal(m) then t2:=convert(m, base, b); mb:=add(t2[i]*10^(i-1), i=1..nops(t2)); return(mb); fi;
od;
lprint("no solution in big10 for n = ", n);
end proc;
b:=2;
[seq(big10(n), n=0..144)]; # A206914
[seq(bigb(n), n=0..144)]; # A265559
MATHEMATICA
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 *)
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
See A206914 for the values of m written in base 10.
Sequence in context: A088761 A215256 A265526 * A265543 A062128 A286618
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Dec 10 2015
STATUS
approved