I came across a problem where i have list $arr[]$ of $M$ integers. I have to find all integers K (given there is at least 1 K)such that :
1) K > 1
2) arr[1]%K = arr[2]%K = arr[3]%K = ... = arr[M]%K
Now in one of the solutions given, the algo was
1. p = abs(arr[0]-arr[1]);
2. Find all divisors of p
3. All the values of K must be among one of the divisors of p
I am not able to understand why the value of $K$ must be within one of the divisors of $p$.