MathGroup Archive 1997

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

Search the Archive

Re: Prime[x] crashes kernel for large x

  • To: mathgroup at
  • Subject: [mg7817] Re: [mg7762] Prime[x] crashes kernel for large x
  • From: Richard Finley <trfin at>
  • Date: Sat, 12 Jul 1997 02:45:56 -0400
  • Sender: owner-wri-mathgroup at

I get the same problem with Mma 3.0 (on a Pentium Pro 200 Win95 system) .. I
have to restart the kernel before proceeding.  One other curiosity, I was
trying to find out approximately what size number would cause it to crash
and I noted that 2^26 was OK but 2^27 consistently crashes.  I started
walking up from 2^26 + 40000000 and found that if I go from that to
2^26+50000000 it crashes, but if I perform consecutive trials from 40000000
in steps of 1000000 I can continue to at least 150000000 (which is greater
than 2^27) without crashing (that's where I ran out of patience...I don't
know how far it would have continued.) Why computing Prime[n+k] should
depend on whether you computed Prime[n] in the previous calculation is
beyond my understanding of Mma but it is certainly true.  For example, if I
compute Prime[2^26 + 40000000]//Timing  , it takes 8.47 sec the first time
you do it, but if you compute it again it gives 0. sec.  It appears it
"remembers" previous calculations and I presume it somehow uses the results
in computations of larger Prime[2^26 + 50000000] crashes only if
you didn't perform Prime[2^26 + 49000000] etc..first. Do others get the same
result on other platforms? Any ideas from anyone ? -- Wolfram ?

At 02:36 PM 7/8/97 -0400, you wrote:
>When I try to find a large prime, for example:
>Prime[2^32 - 1]
>The math kernel crashes with a divide error, and I can't restart it 
>without quitting mathematica (3.0) and restarting.  Am I doing something 
>wrong, or is this a bug? 
>michael at

  • Prev by Date: Forgetfullness
  • Next by Date: Q : Lists as sets.
  • Previous by thread: Prime[x] crashes kernel for large x
  • Next by thread: Re: Prime[x] crashes kernel for large x