# Is the arbitrary base that can be defined by IntegerLength[n,base] really limitless?

I am going to be working with very large numbers, and would like write the input in the base 10 and have the computer output in another arbitrary base. If it truly is limitless, that would be awesome news for the future of the project I am working on.

I keyword searched this site and Wolfram Community under the keyword IntegerLength and found nothing relevant. The documentation on Mathematica 9.0 doesn't specify a limit on using an arbitrary base. I question whether this is truly limitless, since I know that eventually the computer would have to run out of symbols to use to represent a higher number. Or maybe Mathematica has some ingenius way of creating additional symbols forever. I don't know. I was hoping someone could shed some light on how mathematica works.

I did come across this under the tag numbers-base ,

Numbers in alternate bases transcend the evaluator?

that no matter what base is specified in the input, that the computer changes the base of the input into a native base (binary) for processing that is dependant on the hardware. ( I am running a 64 bit system, so (2^64) is the largest processable number and highest base I can define ? ) If this is true, perhaps it would save runtime to not output in a higher base, but rather output in the highest native processing base ? I would however like to use the highest base possible to cut down on the filesize of the output.

• there is always a theoretical upper limit set by the memory of your computer. Then there are the limits that the underlying routines have, AFAIK Mathematica makes use of GMP for representing large numbers in general so these are certainly not limited by 2^64 on your computer, but there still are (much higher) limits. More difficult to answer is where the limits for the specific functions that you are going to use are, unfortunately such details are often not so well documented and a matter of experiments, but it is an area where Mathematica often does quite well... Commented Sep 14, 2015 at 9:15
• If you want to minimize the size of the output, write to a binary format and gzip it at the end. Mathematica's Import and Export can seamlessly handle gzip. In general, encoding into different bases is not going to reduce the size of the data; but it is true in a sense that writing integers into binary format is more or less the same as writing them in base 256, if we think in terms of bytes. Ultimately it's just base 2 in terms of bits, which is why we call it binary. Commented Sep 14, 2015 at 9:32

It appears the maximum base is constrained by the computer's available memory. For example,

i = 10000!;
Table[IntegerLength[i, 2^b], {b, 1, 2^16}]


works (note the maximum base used here is $2^{2^{16}}$, or $2^{65536}$), but

i = 10000!;
Table[IntegerLength[i, 2^b], {b, 1, 2^32}]


doesn't, and produces an error:

General::nomem: The current computation was aborted
because there was insufficient memory available to complete the computation.

SystemException[MemoryAllocationFailure,
{Table[IntegerLength[i,2^b],{b,1,2^32}]}]