For a positive integer n, let f(n) be the number obtained by
writing n in binary and replacing every 0 with 1 and vice versa.
For example, n=23 is 10111 in binary, so f(n) is 1000 in
binary, therefore f(23)=8. Prove that
k=1∑nf(k)≤4n2.
When does equality hold?
(Proposed by Stephan Wagner, Stellenbosch University)
Solution (official)
If r and k are positive integers with 2r−1≤k<2r then
k has r binary digits, so
k+f(k)=r11…1(2)=2r−1.
Assume that 2s−1−1≤n≤2s−1. Then
2n(n+1)+k=1∑nf(k)=k=1∑n(k+f(k))==r=1∑s−12r−1≤k<2r∑(k+f(k))+2s−1≤k≤n∑(k+f(k))==r=1∑s−12r−1⋅(2r−1)+(n−2s−1+1)⋅(2s−1)==r=1∑s−122r−1−r=1∑s−12r−1+(n−2s−1+1)(2s−1)==32(4s−1−1)−(2s−1−1)+(2s−1)n−22s−1+3⋅2s−1−1==(2s−1)n−314s+2s−32
and therefore
4n2−k=1∑nf(k)=4n2−((2s−1)n−314s+2s−32−2n(n+1))==43n2−(2s−23)n+314s−2s+32==43(n−32s+1−2)(n−32s+1−4).
Notice that the difference of the last two factors is less than 1,
and one of them must be an integer: 32s+1−2 is integer
if s is even, and 32s+1−4 is integer if s is odd.
Therefore, either one of them is 0, resulting a zero product, or both
factors have the same sign, so the product is strictly positive.
This solves the problem and shows that equality occurs if
n=32s+1−2 (s is even) or
n=32s+1−4 (s is odd).
How the field did
contestants scored
318
average (of 10)
6.06
solved (≥ 80%)
40.3%
near-0 (≤ 10%)
12.6%
discrimination
0.50
Score distribution (field cohort)
Computed on contestants with a meaningful total (field cohort); discrimination is the corrected item–total correlation.