如何在整数中计算2 ^ n,其中n在10到10000之间?

I am working with some logical problems in my localhost. At a case I need to calculate power of 2 and sum them in integer type to proceed next case. I am using 32 bit system, so I can calculate up to 2^31, as well as sum up to 2147483648 in integer type.

How can I increase the number of power up to 10000? Is there any math library or class available to calculate big integer effectively?

Probably I dont need the power over thousand but I am curious if it is possible in PHP or not. Can anyone answer my with proper reference ?

There are two libraries available in PHP to work with BIG Numbers.

They are,

  1. BC Math
  2. GMP

In both of them GMP has more library function then BC Math.

GMP - It considers leading zeros in a number string as meaning the number is in octal, whereas 'BC' doesn't. Reference: http://www.php.net/manual/en/book.gmp.php