On Jan 21, 5:36*pm, Gary Herron <gher...@islandtraining.comwrote:
tjhn...@gmail.com wrote:
How can I figure out the largest long available? *I was hoping for
something like sys.maxint, but I didn't see it. *Also, can someone
point me to where I can (concisely) read about size of such types
(int, float, long).
There is no explicit (defined) limit. *The amount of available address
space forms a practical limit.
But not the only limitation:
>>import collatz_functions as cf
for k in xrange(1,20):
a = cf.Type12MH(k,1)
print 'number of digits in generation %2d:' %
(k),cf.gmpy.numdigits(a)
number of digits in generation 1: 2
number of digits in generation 2: 9
number of digits in generation 3: 74
number of digits in generation 4: 659
number of digits in generation 5: 5926
number of digits in generation 6: 53328
number of digits in generation 7: 479940
number of digits in generation 8: 4319453
number of digits in generation 9: 38875064
number of digits in generation 10: 349875565
Traceback (most recent call last):
File "<pyshell#12>", line 2, in <module>
a = cf.Type12MH(k,1)
File "C:\Program Files\PyGTK\Python\lib\collatz_functions.py", line
745, in Type12MH
return TWO**(SIX*a - ONE) - ONE
ValueError: mpz.pow outrageous exponent
The power function can't do exponents that have 32 or more bits
even if the memory can hold the resulting number.
>
Gary Herron