# | User | Rating |
---|---|---|
1 | jiangly | 4039 |
2 | tourist | 3841 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3590 |
5 | ecnerwala | 3542 |
6 | Benq | 3535 |
7 | orzdevinwang | 3526 |
8 | gamegame | 3477 |
9 | heuristica | 3357 |
10 | Radewoosh | 3355 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 159 |
3 | Qingyu | 159 |
5 | atcoder_official | 157 |
6 | Um_nik | 154 |
7 | adamant | 151 |
7 | djm03178 | 151 |
7 | luogu_official | 151 |
10 | awoo | 146 |
Name |
---|
First of all, since gcd(x, p) divides p, we have i+kx == j (mod gcd(x, p)). What is i+kx (mod gcd(x, p))? kx is divisible by gcd(x, p), so i+kx becomes just i. We got i == j (mod gcd(x, p)).
But how you are so sure that if I+kx is congruent to j in mod p, the same congruency will be followed in mod gcd(x,p)?
Hi! Consider this: let us have two numbers a, b that are congruent modulo p (a == b (mod p)). Then, a + kp = b. Now let's take both sides modulo some number q, which is a divisor of p. We get a+kp == b (mod q); here, kp is just 0 modulo q, so a == b (mod q). We conclude that, in general, if two numbers are congruent modulo p, they are also congruent modulo any divisor of p (including gcd(p, x)).
ur prooving $$$\Rightarrow$$$ not $$$\Leftrightarrow$$$
i + kx = pn + j (let say where n is any integer) => i = j + (pn — kx) Now, we know gcd(x, p) can be written as ax + bp (here , a = -k and b = n).
thanks!