Description Usage Arguments Details Value Examples
gcd
and lcm
return the greatest common divisor and least common
multiple of all the values present in its arguments.
pgcd
and plcm
return the parallel greatest common divisor
and parallel least common multiple of the input values. They take any
number of vectors as arguments, recycle them to common length and return a
single vector.
1 2 3 4 5 6 7 8 |
... |
integer arguments. |
na.rm |
a logical indicating whether missing values should be removed. |
The greatest common divisor d
of two integers x
and y
(at
least one of which is non-zero) is the greatest number for which x/d
and
y/d
are both integers. When both x
and y
are zero, the
greatest common divisor is also zero.
The least common multiple m
of two non-zero integers x
and
y
is the least number for which m/x
and m/y
are both
integers. When one or both of x
and y
are zero, the least common
multiple is also zero.
If x
or y
is NA
, the greatest common divisor and least
common multiple are also NA
.
It is guaranteed that d * m == abs(x * y)
x
is coprime with y
if their greatest common divisor is 1
.
For gcd
and lcm
an integer vector of length 1. For coprime
a logical vector of length 1.
For pgcd
and plcm
an integer vector. For pcoprime
a logical
vector. If any of the input values is a zero-length vector the result has length
zero. Otherwise, the result has length equal to the length of the longest
vector. The rules for determining the attributes of the result are rather
complicated. Attributes are only copied from input values whose lengths are
equal to the length of the result. If any such input values have a
dim
attribute, the first dim
attribute is copied to the
result. dimnames
are copied in a similar manner (but only
after the result has a dim
attribute). If any such input values
have a conformable dimnames
attribute, the first conformable
dimnames
attribute is copied to the result. If a dim
attribute has
not been assigned to the result, then finally names
are
copied in a similar manner. If any such input values have a names
attribute, the first names
attribute is copied to the result. A result
can have a dim
attribute, a names
attribute, neither, but cannot
have both. dim
has priority over names
(similar to
Arithmetic
operators).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.