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!)
A265509 a(n) = largest base-2 palindrome m <= 2n+1 such that every base-2 digit of m is <= the corresponding digit of 2n+1; m is written in base 10. 70
1, 3, 5, 7, 9, 9, 9, 15, 17, 17, 21, 21, 17, 27, 21, 31, 33, 33, 33, 33, 33, 33, 45, 45, 33, 51, 33, 51, 33, 51, 45, 63, 65, 65, 65, 65, 73, 73, 73, 73, 65, 65, 85, 85, 73, 73, 93, 93, 65, 99, 65, 99, 73, 107, 73, 107, 65, 99, 85, 119, 73, 107, 93, 127, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 153 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
A007088(a(n)) = A265510(n). - Reinhard Zumkeller, Dec 11 2015
LINKS
MAPLE
ispal := proc(n) # test for base-b palindrome
local L, Ln, i;
global b;
L := convert(n, base, b);
Ln := nops(L);
for i to floor(1/2*Ln) do
if L[i] <> L[Ln + 1 - i] then return false end if
end do;
return true
end proc
# find max pal <= n and in base-b shadow of n, write in base 10
under10:=proc(n) global b;
local t1, t2, i, m, sw1, L2;
if n mod b = 0 then return(0); fi;
t1:=convert(n, base, b);
for m from n by -1 to 0 do
if ispal(m) then
t2:=convert(m, base, b);
L2:=nops(t2);
sw1:=1;
for i from 1 to L2 do
if t2[i] > t1[i] then sw1:=-1; break; fi;
od:
if sw1=1 then return(m); fi;
fi;
od;
end proc;
b:=2; [seq(under10(2*n+1), n=0..144)]; # Gives A265509
# find max pal <= n and in base-b shadow of n, write in base b
underb:=proc(n) global b;
local t1, t2, i, m, mb, sw1, L2;
if n mod b = 0 then return(0); fi;
t1:=convert(n, base, b);
for m from n by -1 to 0 do
if ispal(m) then
t2:=convert(m, base, b);
L2:=nops(t2);
sw1:=1;
for i from 1 to L2 do
if t2[i] > t1[i] then sw1:=-1; break; fi;
od:
if sw1=1 then mb:=add(t2[i]*10^(i-1), i=1..L2); return(mb); fi;
fi;
od;
end proc;
b:=2; [seq(underb(2*n+1), n=0..144)]; # Gives A265510
MATHEMATICA
A265509 = FromDigits[Min /@ Transpose[{#, Reverse@#}], 2] &@IntegerDigits[2 # + 1, 2] & (* JungHwan Min, Aug 22 2016 *)
PROG
(Haskell)
a265509 n = a265509_list !! n
a265509_list = f (tail a030308_tabf) [[]] where
f (bs:_:bss) pss = y : f bss pss' where
y = foldr (\d v -> 2 * v + d) 0 ys
(ys:_) = dropWhile (\ps -> not $ and $ zipWith (<=) ps bs) pss'
pss' = if bs /= reverse bs then pss else bs : pss
-- Reinhard Zumkeller, Dec 11 2015
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
Sequence in context: A196189 A206543 A274988 * A265527 A217250 A213923
KEYWORD
nonn,base,look
AUTHOR
N. J. A. Sloane, Dec 09 2015
STATUS
approved

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 March 18 22:56 EDT 2024. Contains 370952 sequences. (Running on oeis4.)