MathLabs

Problem 3

For positive integer kk, let f(k)f(k) be the number of integers in {k+1,…,2k}\{k+1,\ldots,2k\} whose binary expansion has exactly three 11s. Prove every positive integer mm occurs as f(k)f(k), and determine all mm for which exactly one kk has f(k)=mf(k)=m.
Step 5 of 5: Count the corresponding unique values
In plain words

Count the corresponding unique values

m=n(n−1)2+1m=\dfrac{n(n-1)}2+1
Detailed analysis

The interval is {2n+3,…,2n+1+4}\{2^n+3,\ldots,2^{n+1}+4\}. Its three-one numbers are 2n+2r+2s2^n+2^r+2^s with 0≤r<s<n0\le r<s<n, giving (n2)=n(n−1)2\binom n2=\frac{n(n-1)}2 numbers, together with 2n+1+32^{n+1}+3. Thus the unique values are exactly m=n(n−1)2+1m=\frac{n(n-1)}2+1 for integers n≥2n\ge2, namely 2,4,7,11,…2,4,7,11,\ldots.