Find all those $k$ for which $a_1 = a_2 = \cdots =a_n \pmod k$ where $k\ne1$

34 Views Asked by At

We have a list of numbers represented by $a_1,a_2,... ,a_n$.We have to find all those $k$ for which

$$a_1 = a_2 = \cdots =a_n \pmod k.$$

How do we approach this problem mathematically?

Basically , we need to find all those $k$ for which all the numbers in the list gives same when we do modulus with that $k$.

1

There are 1 best solutions below

0
On

Hint: $a_i-a_j \equiv 0 \bmod k$ $\implies k \mid a_i-a_j$ $\implies k \mid \gcd \,\{a_i - a_j \mid 1 \le i \lt j \le n\}$.