Greatest Common Divisor, Least Common Multiple

Share:

Description

Compute the greatest common divisor (GCD) and least common multiple (LCD) of two (big) integers.

Usage

1
2
3
## S3 method for class 'bigz'
gcd(a, b)
lcm.bigz(a, b)

Arguments

a,b

Either integer, numeric, bigz or a string value; if a string, either starting with 0x for hexadecimal, 0b for binary or without prefix for decimal values.

Value

An element of class bigz

Author(s)

Antoine Lucas

References

The GNU MP Library, see http://gmplib.org

See Also

gcdex

Examples

1
2
3
4
gcd.bigz(210,342) # or also
lcm.bigz(210,342)
a <- 210 ; b <- 342
stopifnot(gcd.bigz(a,b) * lcm.bigz(a,b) == a * b)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.