Computation of integer roots and their remainders of vli (Very Large Integers) objects. Functions sqrt
and rootk
returns respectively the integer square root and the integer k-th root of the given value. Functions sqrtrem
and rootkrem
returns the corresponding remainder.
# S3 method for vli
sqrt(x)sqrtrem(x)
# S3 method for default
sqrtrem(x)
# S3 method for numeric
sqrtrem(x)
# S3 method for vli
sqrtrem(x)
rootk(x, k)
# S3 method for default
rootk(x, k)
# S3 method for numeric
rootk(x, k)
# S3 method for vli
rootk(x, k)
rootkrem(x, k)
# S3 method for default
rootkrem(x, k)
# S3 method for numeric
rootkrem(x, k)
# S3 method for vli
rootkrem(x, k)
object of class vli
base of the root; object of class vli or 32 bits integer
index of the root; object of class vli or 32 bits integer
Javier Leiva Cuadrado
x <- as.vli("4124135")
sqrt(x)
sqrtrem(x)
sqrt(x)^2 + sqrtrem(x) == x
if (FALSE) {
rootk(as.vli("1492346293864978561249785"), 5)
}
Run the code above in your browser using DataLab