https://github.com/cran/pracma
Raw File
Tip revision: 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC
version 0.3-0
Tip revision: 392ae21
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