maximum integer length?

Grant Edwards grante at visi.com
Sun Jun 18 11:30:10 EDT 2006


On 2006-06-18, Sybren Stuvel <sybrenUSE at YOURthirdtower.com.imagination> wrote:
> nate enlightened us with:
>> Obviously I didn't have enough memory for that, but I was able to c**3. 
>> (I think anyways, it is still trying to display the result)
>>
>> So I am just wondering how long an integer can be with 400 megabytes of 
>> memory.
>
> I guess the best way would be a binary search for the proper value of
> the integer. You already have an upper (c**d) and a lower (c**3) bound
> for your search.
>
>> each integer takes up a byte right?
>
> That depends on the size of the integer, doesn't it?
>
>> If I have 400 megabytes that would mean I could have a long integer
>> with up to 419,430,400,000 integers?
>
> Que? An integer is just a whole number without fraction. What are you
> talking about?

He's talking about decimal digits.  Each decimal digit takes up
3.322 bits.  A byte can hold about 2.4 digits.  400MB should be
able to hold an integer with about 1,010,000,000 decimal
digits.

-- 
Grant Edwards
grante at visi.com



More information about the Python-list mailing list