NumberTheory
AreCoprime
test whether a sequence of numbers is relatively prime
Calling Sequence
Parameters
Description
Examples
Compatibility
AreCoprime(x1, x2, ..., xn)
AreCoprime(x1, x2, ..., xn, domain_opt)
x1, x2, ..., xn
-
sequence of integers or Gaussian integers
domain_opt
(optional) an equation of the form domain = integer, domain = GaussInt, or domain = gaussian; the default is domain = integer
The AreCoprime function tests whether a sequence of numbers is relatively prime in a given domain. A sequence of numbers are relatively prime (or coprime) if the greatest common divisor of the numbers is equal to 1.
By default, the test is performed in the integer domain (that is, domain = integer). To test whether a sequence of Gaussian integers is relatively prime, use either domain = GaussInt or domain = gaussian for domain_opt.
with⁡NumberTheory:
The AreCoprime function tests if the greatest common divisor of a sequence of numbers is 1 or not. (The igcd function returns the greatest common divisor of a sequence of numbers.)
AreCoprime⁡4,9
true
igcd⁡4,9
1
AreCoprime⁡14,21
false
igcd⁡14,21
7
The domain_opt option can be used to specify the domain. In the following examples, the domain is the Gaussian integers. (The GaussInt:-GIgcd command returns the greatest common divisor of a sequence of Gaussian integers.)
AreCoprime⁡1+2⁢I,1−2⁢I,domain=gaussian
GaussInt:-GIgcd⁡1+2⁢I,1−2⁢I
AreCoprime⁡−3+5⁢I,4+8⁢I,domain=gaussian
GaussInt:-GIgcd⁡−3+5⁢I,4+8⁢I
1+I
The following visualizes the coprimes for the first fifteen integers in dark red:
mat≔Matrix⁡15,i,j↦`if`⁡AreCoprime⁡i,j,1,0
Statistics:-HeatMap⁡mat,color=White,DarkRed
The NumberTheory[AreCoprime] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
GaussInt
GaussInt[GIgcd]
igcd
NumberTheory[InverseTotient]
NumberTheory[Totient]
Download Help Document