gcd.bigz | R Documentation |
Compute the greatest common divisor (GCD) and least common multiple (LCM) of two (big) integers.
## S3 method for class 'bigz'
gcd(a, b)
lcm.bigz(a, b)
a , b |
Either integer, numeric, |
An element of class bigz
Antoine Lucas
The GNU MP Library, see https://gmplib.org
gcdex
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)
## or
(a <- as.bigz("82696155787249022588"))
(b <- as.bigz("65175989479756205392"))
gcd(a,b) # 4
stopifnot(gcd(a,b) * lcm.bigz(a,b) == a * b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.