MathDB
2019 T14: Integer Overflow

Source:

January 27, 2019
2019teamfunction

Problem Statement

Consider the following function.
procedure \textsc{M}(x) <spanclass=latexbold>if</span>0x1\qquad<span class='latex-bold'>if </span>0\leq x\leq 1 <spanclass=latexbold>return</span>x\qquad\qquad<span class='latex-bold'>return </span>x \qquadreturn \textsc{M}(x^2\bmod 2^{32})
Let f:NNf:\mathbb N\to\mathbb N be defined such that f(x)=0f(x) = 0 if \textsc{M}(x) does not terminate, and otherwise f(x)f(x) equals the number of calls made to \textsc{M} during the running of \textsc{M}(x), not including the initial call. For example, f(1)=0f(1) = 0 and f(231)=1f(2^{31}) = 1. Compute the number of ones in the binary expansion of f(0)+f(1)+f(2)++f(2321). f(0) + f(1) + f(2) + \cdots + f(2^{32} - 1).