Codeforces 1295D Same GCDs - Problem Statement

CF 1295D - count values with same GCD

Given aa and mm, count integers xx with 0≤x<m0 \le x < m such that gcd⁡(a,m)=gcd⁡(a+x,m)\gcd(a, m) = \gcd(a + x, m).

Constraints: a,m≤1010a, m \le 10^{10}. The large values mean you can't iterate through all xx.

This problem connects GCD properties to Euler's totient function.