# Stupidly Huge Numbers?

• March 3rd, 2013, 09:34 PM
sci4me
Stupidly Huge Numbers?
Hi all. So I was wondering, what if I want numbers larger than BigInteger? If I understand, I can use many variables or many BigIntegers as one number. I am wondering how I would do such a thing. I have searched around a bit but I will keep looking.
• March 3rd, 2013, 10:05 PM
helloworld922
Re: Stupidly Huge Numbers?
BigInteger has arbitrary bitlengths, and in theory can represent any integer. In practice, you'll run out of physical memory first or the OS/Java runtime will limit how much memory you have.

For a 1GB BigInteger, you can represent stupidly large numbers up to 2^4294967296. This is a 1,292,913,986 digit number.

This is significantly larger than the largest known prime as of Jan 15, 2013.

The only solution is to increase how much memory Java is allowed to use, or increase how much physical memory you have (or use virtual paged memory, though this is extremely slow).
• March 3rd, 2013, 10:08 PM
sci4me
Re: Stupidly Huge Numbers?
is there a way to tell how much memory the variable is taking?
• March 3rd, 2013, 10:51 PM
helloworld922
Re: Stupidly Huge Numbers?