I\'m using the GMP library to make a Pi program, that will calculate about 7 trillion digits of Pi. Problem is, I can\'t figure out how many bits are needed to hold that many de
7 trillion digits can represent any of 10^(7 trillion) distinct numbers.
x bits can represent 2^x distinct numbers.
So you want to solve:
2^x = 10^7000000000000
Take the log-base-2 of both sides:
x = log2(10^7000000000000)
Recall that log(a^b)
= b * log(a)
:
x = 7000000000000 * log2(10)
I get 23253496664212
bits. I would add one or two more just to be safe. Good luck finding the petabytes to hold them, though.
I suspect you are going to need a more interesting algorithm.