OFFSET
0,2
COMMENTS
It seems that this sequence gives the numbers of "2" in the successive sets of 2, which appear in A174353.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..16384
EXAMPLE
a(7) = 32 because 7 = 16*(0) + 7 and a(7) = 128*4^(-1).
a(8) = 2 because 8 == 0 (mod 4).
MAPLE
A174354 := proc(n)
if n <= 3 then
return op(n+1, [1, 2, 2, 8]) ;
end if;
if n mod 4 =0 then
2 ;
elif n mod 4 =1 then
8 ;
elif n mod 4 = 2 then
2
elif n mod 8 = 3 then
32
elif n mod 16 = 15 then
128*4^((n-15)/16)
elif n mod 16 =7 then
128*4^((n-7)/16-1)
end if;
end proc:
seq(A174354(n), n=0..240) ; # R. J. Mathar, Feb 29 2016
MATHEMATICA
Nest[Append[#1, Which[Mod[#2, 4] == 0, 2, Mod[#2, 4] == 1, 8, Mod[#2, 4] == 2, 2, Mod[#2, 8] == 3, 32, Mod[#2, 16] == 15, 128*4^Quotient[#2, 16], True, 128*4^(Quotient[#2, 16] - 1)]] & @@ {#, Length@ #} &, {1, 2, 2, 8}, 91] (* Michael De Vlieger, Nov 06 2018 *)
PROG
(PARI) A174354(n) = if(n<=1, 1+n, if(3==n, 8, if(0==((n%4)%2), 2, if(1==(n%4), 8, if(3==(n%8), 32, if(15==(n%16), 128*4^((n-15)/16), 128*4^((n-7)/16-1))))))); \\ (Adapted from Maple-program) - Antti Karttunen, Nov 06 2018
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Richard Choulet, Mar 17 2010
STATUS
approved