login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Partial sums of A030301.
3

%I #30 Jan 30 2023 19:34:26

%S 0,1,2,2,2,2,2,3,4,5,6,7,8,9,10,10,10,10,10,10,10,10,10,10,10,10,10,

%T 10,10,10,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,

%U 30,31,32,33,34,35,36,37,38,39,40,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42

%N Partial sums of A030301.

%H Kevin Ryde, <a href="/A079954/b079954.txt">Table of n, a(n) for n = 1..8192</a>

%H Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, <a href="https://arxiv.org/abs/2210.10968">Identities and periodic oscillations of divide-and-conquer recurrences splitting at half</a>, arXiv:2210.10968 [cs.DS], 2022, pp. 49-50.

%F a(n) = (n - 1 - (2/3)*(4^e_4-1) - (-1)^e_2*(n - 1 - 2*(4^e_4-1)))/2 where e_4 = floor(log_4(n)) and e_2 = floor(log_2(n)) = floor(log_4(n^2)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 22 2003

%F a(n) = n - A079947(n). Let k=A000523(n), then a(n) = A000975(k) if k even, or a(n) = n - A000975(k) if k odd. - _Kevin Ryde_, Jul 23 2019

%t Accumulate@ Flatten@ Table[1 - Mod[n, 2], {n, 7}, {2^(n - 1)}] (* _Michael De Vlieger_, Oct 29 2022 *)

%o (PARI) a(n) = my(k=logint(n,2), p=(2<<k)\3); if(bittest(k,0), n-p, p); /* _Kevin Ryde_, Jul 23 2019 */

%o (Magma) [&+[Floor(Log(k)/Log(2)) mod 2:k in [1..n]]:n in [1..75]]; // _Marius A. Burtea_, Oct 25 2019

%o (Python)

%o def A079954(n): return ((1<<k)-2)//3 if (k:=n.bit_length())&1 else n-((1<<k)-1)//3 # _Chai Wah Wu_, Jan 30 2023

%Y Cf. A000523, A000975, A030301, A079947.

%K nonn

%O 1,3

%A _N. J. A. Sloane_, Feb 22 2003