next up previous contents index
suivant: Identité de Bézout par monter: Calcul du PGCD par précédent: Traduction TI89 92   Table des matières   Index

Le pgcd dans $ \mathbb {Z}$[i]

On rappelle que $ \mathbb {Z}$[i] = {m + n*i, (m, n) $ \in$ $ \mathbb {Z}$2}.
Soient a $ \in$ $ \mathbb {Z}$[i] et b $ \in$ $ \mathbb {Z}$[i] - {0}, alors on dit que le quotient q de a par b est l'affixe du (ou des) point(s) le plus proche pour le module du point d'affixe a/b.

On tape :

quotient(a,b):={
local q1,q2,c;
c:=normal(a/b);
q1:=re(c);
q2:=im(c);
return round(q1)+i*round(q2);
}
:;
pgcdzi(a,b):={
local q,r;
tantque b!=0 faire
  q:=quotient(a,b);
  r:=a-b*q;
  a:=b;
  b:=r;
ftantque;
//on normalise
si re(a)<0 et im(a)<=0 alors retourne -a;fsi;
si im(a)<0 alors retourne i*a;fsi;
si re(a)<=0 alors retourne -i*a;fsi;
retourne a;
}:;
On tape :
pgcdzi(3+i,3-i)
On obtient :
1+i
On tape :
pgcdzi(7+i,-6+17*i
On obtient :
3+4*i



Documentation de giac écrite par Renée De Graeve