OFFSET
0,5
COMMENTS
a(2^n-1) = 0 for all n.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
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. 40.
FORMULA
a(n) = sum(XORnos(j, floor(j/2)), j=0..n)-((n^2+n)/2).
MATHEMATICA
{0}~Join~MapIndexed[#1 - PolygonalNumber[First[#2]] &, Accumulate[Array[BitXor[#, Floor[#/2]] &, 65]]] (* Michael De Vlieger, Oct 29 2022 *)
PROG
(PARI) a(n) = sum(k=0, n, bitxor(k, k>>1)) - n*(n+1)/2; \\ Michel Marcus, Oct 02 2015
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Antti Karttunen, Jul 14 1999
EXTENSIONS
Corrected by Don Reble, May 01 2006
STATUS
approved