OFFSET
0,4
COMMENTS
Since the binary expansion of n always begins with a 1, a final 0 can't affect the result, so a(2n) = a(n).
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 0..10000
EXAMPLE
...
4 = 100 -> 1
5 = 101 -> 3
6 = 110 -> 2
7 = 111 -> 3
8 = 1000 -> 1
9 = 1001 -> 4
...
MAPLE
rev := proc(lis)
local t1, n, i;
t1:=[]; n:=nops(lis);
for i from 1 to n do t1:=[op(t1), lis[n+1-i]]; end do;
return t1;
end proc;
isPal := proc(L)
local d ;
for d from 1 to nops(L)/2 do
if op(d, L) <> op(-d, L) then
return false;
end if;
end do:
return true;
end proc:
A215467L := proc(L)
local a, c;
a := 1 ;
for c from 2 to nops(L) do
if isPal( [op(1..c, L)] ) then
a := c ;
end if;
end do:
return a;
end proc:
A215467 := proc(n)
if n <= 1 then 1;
else rev(convert(n, base, 2)) ;
A215467L(%) ;
end if;
end proc:
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Aug 11 2012
STATUS
approved