Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Create a sequence from big power numbers

I’m trying to create a sequence of integers from big numbers and couldn’t find a way to suceed. Is there a way to do this ?

I tried :

(2^128):(2^128+3000) which returns: [1] 3.402824e+38

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

So I tried to use the gmp library :

library(gmp)
as.bigz(2^128):as.bigz(2^128+3000)

and got

messages: 1: In as.bigz(2^128):as.bigz(2^128 + 3000) :   numerical
expression has 32 elements: only the first used 2: In
as.bigz(2^128):as.bigz(2^128 + 3000) :   numerical expression has 32
elements: only the first used

>Solution :

Add your sequence to your "big number":

library(gmp)
as.bigz(2^128) + 0:3000
Big Integer ('bigz') object of length 3001:
[1] 340282366920938463463374607431768211456 340282366920938463463374607431768211457 
[3] 340282366920938463463374607431768211458 340282366920938463463374607431768211459
[5] 340282366920938463463374607431768211460 340282366920938463463374607431768211461
# ...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading