Re: How to Generator Prime Numbers in a short time ?
- From: "Chen" <forchen_lc@xxxxxxxxxxx>
- Date: 11 Aug 2006 02:00:54 -0700
Cristiano wrote:
If the sieving step is done over the RAM (e.g. allocate a 'big' block of
RAM, initialize all the bits to 1 and then set the sieved bits to 0), that
is not always the fastest way because of the cache memory.
In my implementation (using GMP library), I get the best speed when I sieve
out the prime < 50000 over a range of 90000 numbers (it seems that the code
must fit in the L1 caches of my Barton). So that, when I need to find a
512-bit prime, the sieving and the SPRP test are done even 100, 500 times.
for(i=0;i<9500;i++) {
temp=(Mod(PrimeTable[i]));
if(temp!=0)
{if(temp%2==1)
p=(PrimeTable[i]-temp)/2;
else
p=(2*PrimeTable[i]-temp)/2;
for(int n=0;n<(1000/PrimeTable[i]);n++)
{ S[p+PrimeTable[i]*n]=1;}
}
else
S[0]=1;
}
Do you mean like this ?
I have tried this method , however , it slower than generator random
numbers
and check with PrimeTable and Miller-Rabin tests.
Why ? Is it that my PrimeTable is not large enough?
90000 numbers as you said ?
It perhaps use too many memory space.
.
- Follow-Ups:
- Re: How to Generator Prime Numbers in a short time ?
- From: Cristiano
- Re: How to Generator Prime Numbers in a short time ?
- References:
- How to Generator Prime Numbers in a short time ?
- From: Chen
- Re: How to Generator Prime Numbers in a short time ?
- From: Phil Carmody
- Re: How to Generator Prime Numbers in a short time ?
- From: Cristiano
- How to Generator Prime Numbers in a short time ?
- Prev by Date: Re: How to Generator Prime Numbers in a short time ?
- Next by Date: Re: Fingerprint as cryptokey
- Previous by thread: Re: How to Generator Prime Numbers in a short time ?
- Next by thread: Re: How to Generator Prime Numbers in a short time ?
- Index(es):
Relevant Pages
|