Sum of Zero Nim-sum k-tuple Revisited

32 Views Asked by At

Inspired by the previous problem, I'd like to ask whether there is a formula calculating $sum_{k}(n)=\sum_{\substack{0 \leq x_1,x_2,\cdots,x_k \leq n \\ x_1 \ xor \ \cdots \ xor \ x_k = 0}}(x_1 + \cdots + x_k)$ in $O(log(n))$.