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 5 of 6: Obtain the recurrence
ak=2ak−1+2k−1−1a_k=2a_{k-1}+2^{k-1}-1
Detailed analysis

Evaluating ff at 2k−12^k-1 gives ak=2ak−1+2k−1−1a_k=2a_{k-1}+2^{k-1}-1. This recurrence holds for k≥1k\ge1, with initial values a0=a1=0a_0=a_1=0 and a2=1a_2=1.