This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A006582 M4053 #37 May 08 2023 02:02:38 %S A006582 0,6,4,12,20,42,32,40,48,78,84,116,148,210,176,176,176,214,212,252, %T A006582 292,378,368,408,448,542,580,676,772,930,832,800,768,806,772,812,852, %U A006582 970,928,968,1008,1134,1172,1300,1428,1650,1584,1616,1648,1782,1812,1948 %N A006582 a(n) = Sum_{k=1..n-1} k XOR n-k. %D A006582 _Marc LeBrun_, personal communication. %D A006582 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A006582 R. J. Mathar, <a href="/A006582/b006582.txt">Table of n, a(n) for n = 2..1000</a> %H A006582 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. 38-39. %H A006582 M. Le Brun, <a href="/A006577/a006577.pdf">Email to N. J. A. Sloane, Jul 1991</a> %F A006582 G.f.: 1/(1-x)^2 * Sum_{k>=0} 2^k * t^3(4t+6)/(1+t)^2, t=x^2^k. - _Ralf Stephan_, Feb 12 2003 %F A006582 a(0) = a(1) = 0, a(2n) = 2a(n) + 2a(n-1) + 4n - 4, a(2n+1) = 4a(n) + 6n. - _Ralf Stephan_, Oct 09 2003 %F A006582 a(n) = 2*(Sum_{k=1..floor((n-1)/2)} k XOR n-k). - _Chai Wah Wu_, May 07 2023 %p A006582 A006582 := proc(n) %p A006582 add(A003987(k,n-k),k=1..n-1) ; %p A006582 end proc: # _R. J. Mathar_, Apr 17 2013 %t A006582 Array[Sum[BitXor[k, # - k], {k, # - 1}] &, 52, 2] (* _Michael De Vlieger_, Oct 27 2022 *) %o A006582 (PARI) a(n)=if(n<2,0,if(n%2==0,2*a(n/2)+2*a(n/2-1)+4*(n/2-1),4*a((n-1)/2)+6*((n-1)/2))) %o A006582 (PARI) a(n)=sum(k=1,n-1, bitxor(k,n-k)) \\ _Charles R Greathouse IV_, Aug 11 2017 %o A006582 (Python) %o A006582 def A006582(n): return sum(k^n-k for k in range(1,n+1>>1))<<1 # _Chai Wah Wu_, May 07 2023 %Y A006582 Antidiagonal sums of array A003987. %K A006582 nonn %O A006582 2,2 %A A006582 _N. J. A. Sloane_