Are Coprime - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

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

> 

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

(1)
> 

igcd⁡4,9

1

(2)
> 

AreCoprime⁡14,21

false

(3)
> 

igcd⁡14,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.)

> 

AreCoprime⁡1+2⁢I,1−2⁢I,domain=gaussian

true

(5)
> 

GaussInt:-GIgcd⁡1+2⁢I,1−2⁢I

1

(6)
> 

AreCoprime⁡−3+5⁢I,4+8⁢I,domain=gaussian

false

(7)
> 

GaussInt:-GIgcd⁡−3+5⁢I,4+8⁢I

1+I

(8)

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

> 

mat≔Matrix⁡15,i,j↦`if`⁡AreCoprime⁡i,j,1,0

mat≔1111111111…1010101010…1101101101…1010101010…1111011110…1000101000…1111110111…1010101010…1101101101…1010001010…⋮⋮⋮⋮⋮⋮⋮⋮⋮⋮15 × 15 Matrix

(9)
> 

Statistics:-HeatMap⁡mat,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]