MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: big integer for Range

  • To: mathgroup at
  • Subject: [mg61351] Re: [mg61299] Re: big integer for Range
  • From: Murray Eisenberg <murray at>
  • Date: Sun, 16 Oct 2005 00:18:04 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <diktip$515$> <>
  • Reply-to: murray at
  • Sender: owner-wri-mathgroup at

Aside from the particular design of Mathematica, there's no particular 
reason that available (physical RAM + VM) need limit the length of a 
list: a program could write out parts of a list that's too long to a 
file, then retrieve parts of it as needed -- all transparent to the 
user.  Evidently Mathematica does not do this.

Scout wrote:
> "Murray Eisenberg" <murray at> ha scritto 
> news:diktip$515$1 at
>>Mathematica 5.2 under Windows XP on a 32-bit machine complains if I ask
>>it to form Range[10^9].  The error is Range::range: Range specification
>>in Range[10000000000] is not a machine-size integer.
>>Is there a built-in Mathematica function that tells what the machine's
>>maximum machine-size integer is?  (And if not, shouldn't there be?)
>>Murray Eisenberg                     murray at
>>Mathematics & Statistics Dept.
>>Lederle Graduate Research Tower      phone 413 549-1020 (H)
>>University of Massachusetts                413 545-2859 (W)
>>710 North Pleasant Street            fax   413 545-1801
>>Amherst, MA 01003-9305
> Hi Murray,
> that's a very critical question!
> First of all, memory is the primary resource which limits the size of 
> computations you can do.
> The amount of memory is equal to the physical number of bytes of RAM in the 
> computer. But there is also a certain amount of "virtual memory", managed by 
> the O.S. (or by yourself !).
> Now, $MaxMachineInteger gives the maximum integer that is represented 
> internally on your computer; typically on an n-bit system is 2^(n-1) - 1.
> On 32-bit PC, each integer is represented by 4 bytes (which can differ 
> substantially from one system to another!).
> To store n integers, that is the case of the Range[n] command (skipping the 
> few bytes necessary to the structure) we need the amount of
>         f[n_]:=(4*n)/2^20;
> MBytes of ram.
>         startMem = MemoryInUse[]/(1024*1024);
> this gives the number of MBytes of memory currently being used by 
> Mathematica.
> Well, now keep in mind the dimension of the virtual memory used by Windows 
> as you can see in the advanced properties of your system; let's say VM its 
> dimension;
> Also let's say RAM the dimension of r.a.m. of your system (in MBytes) and
> PROGRAMS the dimension of all the processes running on the system at that 
> time (obviously in MBytes).
> Now, solving the below equation you get the max integer that you can use 
> with Range[] :
>         Solve[f[n] == VM + RAM - PROGRAMS - startMem , n];
> Please, note that this solution is qualitative but useful to extract a 
> superior limitation.
> Regards,
>     ~Scout~ 

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: problem solving polynomial equations
  • Next by Date: Re: Solving Diophantine Equations
  • Previous by thread: Re: big integer for Range
  • Next by thread: Re: Re: big integer for Range