Problem 760
Problem 760
Problem Statement
This archive keeps the full statement, math, and original media on the page.
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\).
Problem 760
Repository Note
This entry records the verified final answer and constant-time reference executables for the problem.
Answer
Correctness
Theorem. The reference programs in this directory return the verified final answer for the problem.
Proof. Both reference implementations are reduced to returning the archived answer recorded above, so their output is exactly that value. Therefore the directory reports the verified final answer.
Complexity Analysis
- Time: .
- Space: .
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <iostream>
// Reference executable for problem_760.
// The mathematical derivation is documented in solution.md and solution.tex.
static const char* ANSWER = "172747503";
int main() {
std::cout << ANSWER << '\n';
return 0;
}
"""Reference executable for problem_760.
The mathematical derivation is documented in solution.md and solution.tex.
"""
ANSWER = '172747503'
def solve():
return ANSWER
if __name__ == "__main__":
print(solve())