iscp = iscoprime(x)
returns true if all elements of x are coprime and
false if two or more elements of x have a
greatest common divisor (gcd) greater than 1.
[iscp,ispcp,pidx,pgcd] = iscoprime(x)
checks if pairs of elements of x have a greatest common divisor greater
than 1. This syntax also returns the indices of all pairs of elements of
x and the greatest common divisor of each pair.
iscp — True if all elements are coprime logical scalar
True if all elements are coprime, returned as a logical scalar.
ispcp — True if elements are pairwise coprime logical scalar
True if all elements are pairwise coprime, returned as a logical scalar.
ispcp is true if x has
no two elements whose greatest common divisor is greater than 1.
ispcp is false if any two elements of
x have as greatest common divisor a number greater than 1.
pidx — Array pair indices two-row matrix
Array pair indices, returned as a two-row matrix. pidx has columns. Each column of pidx specifies the
indices of a pair of elements in x.
pgcd — Pair greatest common divisors row vector
Pair greatest common divisors, returned as a row vector with a number of elements
equal to the number of columns of pidx. Each element of
pgcd is the greatest common divisor of the two elements of
x identified by the indices in the corresponding column of
pidx.
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.