Re: Prime[x] crashes kernel for large x
- To: mathgroup at smc.vnet.net
- Subject: [mg7926] Re: [mg7762] Prime[x] crashes kernel for large x
- From: esw at harrier.fen.bris.ac.uk (Eddy)
- Date: Wed, 23 Jul 1997 15:46:06 -0400
- Organization: University of Bristol, England
- Sender: owner-wri-mathgroup at wolfram.com
For Mma 2.0, a calculation may depend on previous calculation. As you've already tested, the timing of a calculation after the first one may give zero time. It is stated on "Mathematica: A System for Doing Mathematics with Computer" for version 2.0, and I'm sure it's also stated on the book for version 3.0. === -Eddy Richard Finley (trfin at fiona.umsmed.edu) wrote: > 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 primes...so 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 ? > RF