MathLabs

Problem 4

Consider the function f:N0→N0f:\mathbb N_0\to\mathbb N_0, where N0\mathbb N_0 is the set of all non-negative integers, defined by f(0)=0f(0)=0, f(2n)=2f(n)f(2n)=2f(n) and f(2n+1)=n+2f(n)f(2n+1)=n+2f(n) for all n≥0n\ge0. (a) Determine the three sets L={n∣f(n)<f(n+1)}L=\{n\mid f(n)<f(n+1)\}, E={n∣f(n)=f(n+1)}E=\{n\mid f(n)=f(n+1)\}, and G={n∣f(n)>f(n+1)}G=\{n\mid f(n)>f(n+1)\}. (b) For each k≥0k\ge0, find a formula for ak=max⁡{f(n):0≤n≤2k}a_k=\max\{f(n):0\le n\le2^k\} in terms of kk.
Step 4 of 6: Locate the maximum
ak=f(2k−1)(k≥2)a_k=f(2^k-1)\quad(k\ge2)
Detailed analysis

For k=2k=2 the claim is immediate. Assume it for k−1k-1. For even n=2tn=2t in the upper half of 0≤n≤2k0\le n\le2^k, the recurrence gives f(n)≤2ak−1f(n)\le2a_{k-1}. For odd n=2t+1n=2t+1 there, f(n)≤2k−1−1+2ak−1f(n)\le2^{k-1}-1+2a_{k-1}. Both bounds are at most f(2k−1)=2k−1−1+2f(2k−1−1)f(2^k-1)=2^{k-1}-1+2f(2^{k-1}-1), so the maximum is attained at 2k−12^k-1.