|
Further Examples: ExtendedGCD
The first element in the output from ExtendedGCD[n, m] is the greatest common divisor of the integers n and m.
In[1]:= 
Out[1]= 
In[2]:= 
Out[2]= 
The second element is a pair of integers. The linear combination of n and m with these as coefficients gives the gcd.
In[3]:= 
Out[3]= 
These two numbers are relatively prime.
In[4]:= 
Out[4]= 
Therefore this linear combination gives .
In[5]:= 
Out[5]= 
ExtendedGCD works on Gaussian integers as well.
In[6]:= 
Out[6]= 
This checks the results.
In[7]:= 
Out[7]= 
In[8]:= 
Out[8]= 
In[9]:= 
Out[9]= 
This clears the definitions.
In[10]:= 
|