a huge integer power 3 power n

Torbjörn Granlund tg at gmplib.org
Wed Aug 31 09:48:39 UTC 2016

Thomas Brouard <mailbidonjustice at gmail.com> writes:

  Thanks for this answer. Yeah, that’s what I want, I want to know how
  should I write the program if I may.
  I would love to know how to use libm. I don’t know what it is.
The C/C++ standard math library, described in any decent C or C++ book.

  I would love that it could be possible for me up to n=19. I don’t
  know. I would appreciate your help up to 18.
  May I know your configuration?
I have a machine with 96 GiB of RAM, so with GMP's memory overhead I
suppose n=18 as I claimed before will be hard, but n=16 should work.

Unfortunately, you will run into limitations of GMP's mpz type, so you
will need the low-level mpn layer.  If you struggle using mpz, you might
find mpn to be a little tricky to use.

  What should I buy to make it possible until 20? 
For n=19 you'd need slightly more than one TiB of RAM; for n=20 you'd
need about 4 TiB.

You need to buy a computer which will cost you at least 100000 USD.

  How to store a 1 000 000 000 digits integer and how to store a 100 000
  000 digits integer? Who can I ask for this?

That depends a lot on your storage.  I believe computing your numbers in
RAM will be the real challenge, then storing the result will take just a
bunch of high-end spinning rust disks.

(And you seem to miscompute the size of the result; for n=20 you'd get
numbers of one trillion digits.)

Please encrypt, key id 0xC8601622

More information about the gmp-discuss mailing list