Mathematica 9 is now available

ExtendedGCD

Usage

ExtendedGCD[n, m] 给出整数 nm 的扩充最大公约数.


Notes

• 整数数学函数(参见 节 A.3.10).
ExtendedGCD[n, m] 返回列表 g,  r, s  , 其中 gGCD[n, m], rs 满足关系  .
• 参见 Mathematica 全书: 3.2.4.
• 同时参见: GCD.
Further Examples

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]:=  



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.