#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<ll>a;
ll gcd(ll a, ll b)
{
if(b == 0)
return a;
return gcd(b, a%b);
}
int main()
{
ll n, i;
while(cin >> n && n != 0)
{
a.push_back(n);
ll x;
while(cin >> x && x != 0)
{
a.push_back(x);
}
ll g = 0, difference;
for(i=1;i<a.size();i++)
{
difference = abs(a[i] - a[i-1]);
g = gcd(g, difference);
}
cout << g << endl;
a.clear();
}
return 0;
}
Comments
Post a Comment