MathLabs

Problem 2

For which pairs of positive integers (a,b)(a,b) is the sequence gcd⁡(an+b,bn+a)\gcd(a^n+b,b^n+a), n=1,2,…n=1,2,\ldots, eventually constant?
Step 4 of 5: Use xnx_n to pin down a and b modulo M
In plain words

Since xnx_n equals xn−1x_{n-1}, the modulus MM also divides xnx_n, meaning it divides an+ba^n+b and bn+ab^n+a directly; combined with ana^n and bnb^n both being 11 modulo MM, this forces bb and aa to each be −1-1 modulo MM.

a≡b≡−1(modM)a\equiv b\equiv-1\pmod M
Detailed analysis

Since xn=xn−1x_n=x_{n-1} and M∣xn−1M\mid x_{n-1} (Step 3), also M∣xnM\mid x_n, so M∣an+bM\mid a^n+b and M∣bn+aM\mid b^n+a. Using an≡1,bn≡1(modM)a^n\equiv1,b^n\equiv1\pmod M, this gives 0≡1+b(modM)0\equiv1+b\pmod M and 0≡1+a(modM)0\equiv1+a\pmod M, i.e. a≡b≡−1(modM)a\equiv b\equiv-1\pmod M.