John W. Nicholson on Thu, 26 Jan 2012 10:42:30 +0100

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


OK, I have some questions.

Let us start with the following quote:
3.13.26 primelimit: gp precomputes a list of all primes less than primelimit at initialization
time. These are used by many arithmetic functions, usually for trial division purposes. If you do
not plan to invoke any of them, you can just set this to 1. The maximal value is a little less than
2^32 (resp 2^64) on a 32-bit (resp. 64-bit) machine.
Since almost all arithmetic functions eventually require some table of prime numbers, PARI
currently guarantees that the rst 6547 primes, up to and including 65557, are precomputed, even
if primelimit is 1.
The default value is 500k.
What is the true value for "a little less 2^32 (resp 2^64) on a 32-bit (resp. 64-bit) machine"? 
And, see what it did below?
? primelimit=2^64
%1 = 18446744073709551616
Then I did

  ***   at top-level: primepi(2^64)
  ***                 ^-------------
  *** primepi: overflow in t_INT-->ulong assignment.
  ***   Break loop: type 'break' to go back to GP
break> break

? primepi(2^63)
  ***   at top-level: primepi(2^63)
  ***                 ^-------------
  *** primepi: not enough precomputed primes, need primelimit ~ 9223372036854775808.
  ***   Break loop: type 'break' to go back to GP
break> break
Down to ...

? primepi(2^32)
  ***   at top-level: primepi(2^32)
  ***                 ^-------------
  *** primepi: not enough precomputed primes, need primelimit ~ 4294967296.
  ***   Break loop: type 'break' to go back to GP
break> primepi(2^31)

More info:

                  GP/PARI CALCULATOR Version 2.5.0 (released)
          amd64 running linux (x86-64/GMP-5.0.1 kernel) 64-bit version
        compiled: Sep  4 2011, gcc-4.6.1 (Ubuntu/Linaro 4.6.1-7ubuntu2) 
                 (readline v6.2 enabled, extended help enabled)

                     Copyright (C) 2000-2011 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes 

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 8000000, primelimit = 4000000483
If the above is program error, how to get it fixed?
If the above is manual error, how to get it fixed?

More questions, 
How to get a program like this (For Ramanujan primes, sent to me by CG4):

    my(L=vector(nn), s=2, p=3);
    forprime(q=5, prime(3*nn),

        if(s++ < nn, L[s] = p);
        forstep(k=p+1, q-2, 2,
            if(isprime(k/2), s--);
        if(isprime(q\2), s--);
        if(s<=nn, L[s]=q-1);
        p = q

To be pre-computed like the primes?  Currently, have to manually copy and paste the program in order to get it to work. I know I read some thing with files, but can they pre-installed or pre-computed? 
(I tried to place the program above in .gprc.)
Note that the results are all primes, so really I just need the respectable, prime index to Ramanujan prime index, and Ramanujan index to prime index functions along with the pre-computed primes.
How can I insure the primes generated by GP have not been corrupted?

Is there a way to know how much memory is needed to be allocated for just the primes? A rule thumb for doing other things?

Any swap file use?


John W. Nicholson