P760
projecteuler.net

Sum over Bitwise Operators

ℹ️Published on Sunday, 27th June 2021, 02:00 am; Solved by 470;
Difficulty rating: 35%

Define $$\displaystyle g(m,n) = (m\oplus n)+(m\vee n)+(m\wedge n)$$ where $\oplus, \vee, \wedge$ are the bitwise XOR, OR and AND operator respectively.

Also set $$\displaystyle G(N) = \sum_{n=0}^N\sum_{k=0}^n g(k,n-k)$$

For example, $G(10) = 754$ and $G(10^2) = 583766$.

Find $G(10^{18})$. Give your answer modulo $1\,000\,000\,007$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.