swh:1:snp:1d6f9c912933e835b749aef1f8077112982fe84e
Raw File
Tip revision: f2b1a2b0b321bb40a034d89a636072cd71ad25cc authored by HwB on 21 November 2011, 00:00:00 UTC
version 0.8.6
Tip revision: f2b1a2b
gcd.Rd
\name{GCD, LCM}
\alias{GCD}
\alias{LCM}
\title{GCD and LCM Integer Functions}
\description{
  Greatest common divisor and least common multiple
}
\usage{
GCD(n, m)
LCM(n, m)
}
\arguments{
  \item{n, m}{integer scalars}
}
\details{
  Computation based on the extended Euclidean algorithm in \code{extGCD}.
}
\value{
  a numeric (integer) value
}
\note{
  The following relation is always true:

  \code{n * m = GCD(n, m) * LCM(n, m)}
}
\seealso{
\code{\link{extGCD}}, \code{\link{coprime}}
}
\examples{
GCD(12, 10)
GCD(46368, 75025)  # Fibonacci numbers are relatively prime to each other
LCM(12, 10)
LCM(46368, 75025)  # = 46368 * 75025
}
\keyword{ arith }
back to top