ordered list
1. LCM(a, b) = a / GCD(a, b) × b;//First divide and then multiply to prevent the number from exploding
2. Euclidean cpp
void gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
3. Extended Euclidean
void exgcd(LL a, LL b, LL &x, LL &y, LL &d){
if (!b) {d = a, x = 1, y = 0;}
else{
exgcd(b, a % b, y, x, d);
y -= x * (a / b);
}
}
4. Solutions of Linear Modular Equations
void mod_line(int a, int b, int n)
{
int d, x, y, x0, i;
exgcd(a, n, x, y,d);
if(b%d == 0)
{
x0 = x * (b/d) % n + n;
for(i = 0;i < d;i ++)
cout << (x0 + i*n/d) % n <<endl;
}
}