Are Coprime - Maple Help

# Online Help

###### All Products    Maple    MapleSim

NumberTheory

 AreCoprime
 test whether a sequence of numbers is relatively prime

 Calling Sequence AreCoprime(x1, x2, ..., xn) AreCoprime(x1, x2, ..., xn, domain_opt)

Parameters

 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

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$

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.)

 > $\mathrm{AreCoprime}\left(4,9\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{igcd}\left(4,9\right)$
 ${1}$ (2)
 > $\mathrm{AreCoprime}\left(14,21\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{igcd}\left(14,21\right)$
 ${7}$ (4)

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.)

 > $\mathrm{AreCoprime}\left(1+2I,1-2I,\mathrm{domain}=\mathrm{gaussian}\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{GaussInt}:-\mathrm{GIgcd}\left(1+2I,1-2I\right)$
 ${1}$ (6)
 > $\mathrm{AreCoprime}\left(-3+5I,4+8I,\mathrm{domain}=\mathrm{gaussian}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{GaussInt}:-\mathrm{GIgcd}\left(-3+5I,4+8I\right)$
 ${1}{+}{I}$ (8)

The following visualizes the coprimes for the first fifteen integers in dark red:

 > $\mathrm{mat}≔\mathrm{Matrix}\left(15,\left(i,j\right)↦\mathrm{if}\left(\mathrm{AreCoprime}\left(i,j\right),1,0\right)\right)$
 ${{\mathrm{_rtable}}}_{{36893628337898877524}}$ (9)
 > $\mathrm{Statistics}:-\mathrm{HeatMap}\left(\mathrm{mat},\mathrm{color}=\left["White","DarkRed"\right]\right)$
 > 

Compatibility

 • The NumberTheory[AreCoprime] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.

 See Also