Karim Belabas on Mon, 26 May 2014 15:47:17 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: bug in PARI/GP (Segmentation Fault), please report.


* John W. Nicholson [2014-05-26 15:00]:
> But then, I wonder what I would need to do if I need to have prime
> values like prime(10^10) or greater as to make it where it don't take
> over 5 minutes to calculate one prime?

Our implementation of prime(n) runs in time O~(n), it's a very expensive
way to iterate over primes. Use forprime:

  (15:45) gp > n = 0; forprime(p=10^50, 10^50+10^7, n++); n
  time = 30,094 ms.
  %1 = 87112

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`