login
A174354
a(0)=1, a(1)=a(2)=2, a(3)=8 and for n >= 4: if n == 0 (mod 4), a(n)=2, if n == 1 (mod 4), a(n)=8, if n == 2 (mod 4), a(n)=2, if n == 3 (mod 8), a(n)=32, if n = 16k + 15, a(n) = 128*4^k, and if n = 16k+7, a(n) = 128*4^(k-1).
2
1, 2, 2, 8, 2, 8, 2, 32, 2, 8, 2, 32, 2, 8, 2, 128, 2, 8, 2, 32, 2, 8, 2, 128, 2, 8, 2, 32, 2, 8, 2, 512, 2, 8, 2, 32, 2, 8, 2, 512, 2, 8, 2, 32, 2, 8, 2, 2048, 2, 8, 2, 32, 2, 8, 2, 2048, 2, 8, 2, 32, 2, 8, 2, 8192, 2, 8, 2, 32, 2, 8, 2, 8192, 2, 8, 2, 32, 2, 8, 2, 32768, 2, 8, 2, 32, 2, 8, 2
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
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
Cf. A174353.
Sequence in context: A343059 A161915 A342818 * A011147 A273168 A098818
KEYWORD
easy,nonn
AUTHOR
Richard Choulet, Mar 17 2010
STATUS
approved