cino hilliard on Sun, 24 Sep 2006 15:01:11 +0200

 Re: PrimeLimit

```

```
```From: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
To: pari-users@list.cr.yp.to
Subject: Re: PrimeLimit
Date: Fri, 22 Sep 2006 14:40:44 +0200

* Tautócrona [2006-09-20 15:20]:
> I usually work with primes in Pari-GP, and find the PrimeLimit
> parameter very small for my purposes. I know that with the command
> Default(PrimeLimit, N) I can make PrimeLimit as big as N, but N ~
> 4*10^9 seems to be the final limit.
```
```
```
```(11:22) gp > default(primelimit,2^31)
time = 14,648 ms.
(11:22) gp > gettime(); for (i=25,31, forprime(p=2,2^i,); print(gettime()))
60
124
228
444
845
1629
3140

Nicely linear in forprime's upper bound...
```
```
The log of these is nicely linear.
1.77815125
2.093421685
2.357934847
2.64738297
2.926856709
3.211921084
3.496929648

```
You store the prime differences in the gp environment. Do you keep a running prime every so
```often to increment from or do you just add up the differences?

```
I have beat the prime limit problem from the standpoint of prime(x) by using a sieve program to store the 37,607,912,018 primes less than a trillion in binary format which requires 301 gigs of file space. Then I call a prime c program that reads this file with a prime2 routine in Pari.
```
```
prime2(n) = \\ the nth prime using f:\sieve\primeapigcc.exe calling prime2-1000bill.bin
```             {
local(x,s);
s=concat("f:/sieve/primeapigcc ",Str(n));
```
s=concat(s," > temp.txt"); \\Must save to a temp file for correct output
```             system(s);
}

For example.
(16:43:03) gp > prime2(37607912018)
%40 = 999999999989

```
The sieve program takes about 1/2 a day to store. I would like to use a difference scheme to store many more primes in a lot less space. I guess the problem here will be speed again.
```
```
My guess that the ith prime for every million primes could be stored in a seperate file with a value indication the record of the difference file. The we just add from that point.
```
This would reduce the file considerabley or allow a whole bunch more primes.

Enjoy,
Cino Hilliard,

```

• References:
• Re: PrimeLimit
• From: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>