Problem

Source: India TST 2016 Day 3 Problem 1

Tags: number theory, recurrence relation, power of 2, geometry, bir tinga qimmat ekan boru



Let $n$ be a natural number. We define sequences $\langle a_i\rangle$ and $\langle b_i\rangle$ of integers as follows. We let $a_0=1$ and $b_0=n$. For $i>0$, we let $$\left( a_i,b_i\right)=\begin{cases} \left(2a_{i-1}+1,b_{i-1}-a_{i-1}-1\right) & \text{if } a_{i-1}<b_{i-1},\\ \left( a_{i-1}-b_{i-1}-1,2b_{i-1}+1\right) & \text{if } a_{i-1}>b_{i-1},\\ \left(a_{i-1},b_{i-1}\right) & \text{if } a_{i-1}=b_{i-1}.\end{cases}$$Given that $a_k=b_k$ for some natural number $k$, prove that $n+3$ is a power of two.