Let a>1 be a positive integer and d>1 be a positive integer coprime to a. Let x1=1, and for k≥1, define
xk+1={xk+dxk/aif a does not divide xkif a divides xk
Find, in terms of a and d, the greatest positive integer n for which there exists an index k such that xk is divisible by an. number theoryISL 2022IMO ShortlistSequence