Adam Kaminsky
Adam Kaminsky

Reputation: 21

How to use gmp library with R

I have installed package "gmp" and in general I can use the library, e.g. call pow.bigz(), but I need to switch to the big integers and have problems:

    > cat(factorize(121), "\n")
    02 00 00 00 01 00 00 00 01 00 00 00 0b 00 00 00 01 00 00 00 01 00 00 00 0b 00 00 00

Upvotes: 2

Views: 1988

Answers (1)

user5821909
user5821909

Reputation:

#Self explained examples

#eg1 big-big-numbers

   library(gmp)
   x <- pow.bigz(5,4^9)  #x<- 5^4^3^2
   cat("5^4^3^2, Digits: ",sizeinbase(x, b=10))

#eg2 big mult

   mul.bigz(1.2345e+276, 5.6789e+255)

#eg3

  x <- as.bigz("12345678987654321")
     factorize(x)

Upvotes: 5

Related Questions