I believe that you are working with a BigInt, which is known as long
in Python - it expands and occupies a variable amount of RAM as needed. The name long
can be confusing, as that means a specific number of bytes in a handful of popular languages of today. The following can help you get at the number of bytes it takes to store the object.
Python 2.6.2 (r262:71600, Aug 14 2009, 22:02:40)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import sys
>>> a = 1
>>> sys.getsizeof(a)
12
>>> import math
>>> sys.getsizeof(math.factorial(100))
84
>>> sys.getsizeof(math.factorial(200))
182
>>>