The gcd command finds the greatest common
divisor (GCD) of a set of integers or polynomials. (See also
Section 6.28.5 for polynomials.) It can be called with one or two
arguments.
igcd is a synonym for gcd.
With one argument:
Examples.
3 |
3 |
3 |
3+2 i |
With two arguments:
Examples.
⎡ ⎣ | 3,5,4 | ⎤ ⎦ |
essai(n):={ |
local j,a,L; |
L:=NULL; |
for (j:=-n;j<n;j++) { |
a:=f(j); |
if (a!=1) { |
L:=L,[j,a]; |
} |
} |
return L; |
}
|
⎡ ⎣ | −16,7 | ⎤ ⎦ | , | ⎡ ⎣ | −9,7 | ⎤ ⎦ | , | ⎡ ⎣ | −2,7 | ⎤ ⎦ | , | ⎡ ⎣ | 5,7 | ⎤ ⎦ | , | ⎡ ⎣ | 12,7 | ⎤ ⎦ | , | ⎡ ⎣ | 19,7 | ⎤ ⎦ |
Since gcd(a,b) = gcd(a,b−c· a) for integers a,b and c; we have gcd(4n+1,5n+3)=gcd(4n+1,5n+3−(4n+1)) =gcd(4n+1,n+2) = gcd(4n+1−4(n+2),n+2) = gcd(−7,n+2) = gcd(7,n+2), and so gcd(4n+1,5n+3)=7 if 7 divides n+2, namely n+2 = 7k or n=7k−2, and gcd(4n+1,5n+3)=1 otherwise. This proves the conjecture.
The Gcd command is the inert form of gcd; namely, it evaluates to gcd, for later evaluation.
Examples.
gcd | ⎛ ⎝ | 18,15 | ⎞ ⎠ |
3 |