[back] [prev] [next] [index] [root]

 


IntXGcd

Extended Euclidean algorithm.

Syntax:

G := IntXGcd (a1,a2);
G := IntXGcd (L);

list
  G  
integer
  a1  
integer
  a2  
list
  L  

See also:  IntGcd

Description:

The IntXGcd function computes the greatest common divisor g of integers a_1, … ,a_n. g is the first element of the list G which will be returned by IntXGcd. The second element of G is another list which contains the representation of g by a_1, … ,a_n.\medskip IntXGcd (a1,a2); computes the greatest common divisor of a_1, a_2 and its representation.\smallskip IntXGcd (L); Let L be a list of rational integers a_1, … ,a_n. The IntXGcd computes the greatest common divisor of a_1, … ,a_n and its representation.


Example:


kash> G := IntXGcd(2345,-505);
[ 5, [ 14, 65 ] ]
kash> G[2][1]*2345+G[2][2]*(-505);
5
kash> G := IntXGcd([12,18,21]);
[ 3, [ 3, -3, 1 ] ]
kash> G[2][1]*12+G[2][2]*18+G[2][3]*21;
> 3


<- back[back] [prev] [next] [index] [root]