% Generated by xcas
\documentclass{article} 
 \usepackage{pstricks} 
 \begin{document} 
\begin{verbatim}
 (a,b)-> 
{ local r; 
  while(b!=0){ 
      r:=irem(a,b);  
      a:=b;  
      b:=r;  
    };  
  return(a);  
}
\end{verbatim}\begin{verbatim}
 (a,b)->{ 
  if (b==0) return(a); else return(pgcdr(b,irem(a,b)));; ;  
}
\end{verbatim}\begin{verbatim}
 (a,b)-> 
{ local la,lb,lr,q,lb2; 
  la:=[1,0,eval(a)];  
  lb:=[0,1,eval(b)];  
  lb2:=eval(b);  
  while(lb2!=0){ 
      q:=iquo(la[2],lb2);  
      lr:=la+(-q)*lb;  
      la:=lb;  
      lb:=lr;  
      lb2:=lb[2];  
    };  
  return(la);  
}
\end{verbatim}\begin{verbatim}
 (a,b)-> 
{ local lb,q,r; 
  if (b!=0) { 
      q:=iquo(a,b);  
      r:=irem(a,b);  
      lb:=bezoutr(b,r);  
      return([lb[1],lb[0]+(-q)*lb[1],lb[2]]);  
    } 
   else return([1,0,a]);; ;  
}
\end{verbatim}\begin{equation} \label{eq:4}
pgcd(15,25) = 5
\end{equation}
\begin{equation} \label{eq:5}
\mbox{debug}(pgcd(15,25)) = 5
\end{equation}
\begin{equation} \label{eq:6}
pgcdr(15,25) = 5
\end{equation}
\begin{equation} \label{eq:7}
\mbox{debug}(pgcdr(15,25)) = 5
\end{equation}
\begin{equation} \label{eq:8}
\mbox{debug}(pgcdr(15,25)) = \mbox{Program killed Error: Bad Argument Value}
\end{equation}
\begin{equation} \label{eq:9}
\mbox{debug}(pgcdr(15,25)) = 5
\end{equation}
\begin{equation} \label{eq:10}
\mbox{debug}(pgcdr(15,25)) = 5
\end{equation}

\end{document}
