# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a090889 Showing 1-1 of 1 %I A090889 #24 Jul 22 2024 03:26:05 %S A090889 0,0,2,4,14,24,40,56,96,136,186,236,310,384,472,560,712,864,1034,1204, %T A090889 1414,1624,1856,2088,2392,2696,3026,3356,3742,4128,4544,4960,5536, %U A090889 6112,6722,7332,8014,8696,9416,10136,10976,11816,12698,13580 %N A090889 Double partial sums of (n * its dyadic valuation). %C A090889 Hwang-Janson-Tsai paper, p. 39: "Note that the recurrence provided on OEIS for A090889 is incorrect (and the generating function misses a factor of 2)." - _Michael De Vlieger_, Oct 30 2022 %H A090889 Michael De Vlieger, Table of n, a(n) for n = 0..10000 %H A090889 Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, Identities and periodic oscillations of divide-and-conquer recurrences splitting at half, arXiv:2210.10968 [cs.DS], 2022, p. 39. %F A090889 a(0)=0, a(2n) = 2a(n) + 2a(n-1) + n(n+1)(2n+1)/3, a(2n+1) = 4a(n) + (2/3)*(n+1)(n+2)(n+3). %F A090889 G.f.: (1/(1-x)^2) * Sum_{k>=0} 2^k*t^2/(1-t^2)^2 where t=x^2^k. %F A090889 a(n) = A006581(n) + A000292(n-1). %t A090889 {0}~Join~Accumulate@ Accumulate@ Array[# IntegerExponent[#, 2] &, 43] (* _Michael De Vlieger_, Oct 30 2022 *) %o A090889 (PARI) a(n)=sum(k=1,n,bitand(k,n-k)+k*(n-k)) %o A090889 (PARI) a(n)=if(n<1,0,if(n%2==0,2*a(n/2)+2*a(n/2-1)+n/2*(n/2+1)*(n+1)/3,4*a((n-1)/2)+2/3*((n-1)/2)*((n-1)/2+1)*((n-1)/2+2))) %o A090889 (PARI) a(n)=sum(l=0,n,sum(k=0,l,k*valuation(k,2))) %o A090889 (Python) %o A090889 def A090889(n): return (sum(k&n-k for k in range(1,n+1>>1))<<1)+(0 if n&1 else n>>1)+n*(n-1)*(n+1)//6 # _Chai Wah Wu_, May 08 2023 %Y A090889 Cf. A006581, A000292, A007814. %K A090889 nonn,easy %O A090889 0,3 %A A090889 _Ralf Stephan_, Feb 13 2004 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE