Are Coprime - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


NumberTheory

  

AreCoprime

  

test whether a sequence of numbers is relatively prime

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

withNumberTheory:

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

AreCoprime4,9

true

(1)

igcd4,9

1

(2)

AreCoprime14,21

false

(3)

igcd14,21

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

AreCoprime1+2I,12I,domain=gaussian

true

(5)

GaussInt:-GIgcd1+2I,12I

1

(6)

AreCoprime3+5I,4+8I,domain=gaussian

false

(7)

GaussInt:-GIgcd3+5I,4+8I

1+I

(8)

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

matMatrix15,i,j`if`AreCoprimei,j,1,0

Statistics:-HeatMapmat,color=White,DarkRed

Compatibility

• 

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

NumberTheory[InverseTotient]

NumberTheory[Totient]