Re: [PrimeNumbers] Re: Best algorithm to check if a number is prime??
- --On Tuesday, September 02, 2003 1:05 AM +0000 Paul Underwood
> --- In email@example.com, "ashok_iiit"However, it is much faster on numbers even a little smaller -
> <g_ashok@g...> wrote:
>> I am new to the prime numbers. Does anyone know what is
>> deterministic algorithm that says if a number is prime. If
>> one can guide to me with a link to the code that implements
>> that alogrithm, please do include that.
>> When I heard of the largest prime number I was
>> surprised how one could determine if its a prime
>> number. Later I saw that the ZIMP program uses the
>> properties of mersenne numbers. If u can
>> to me with a link to the code that implements that alogrithm,
>> do include that.
>> And are there any other numbers such as mersenne
>> numbers which can help in finding largest prime
> For a general purpose proving algorithm see:
> this program will take several months to prove a number with
> say 6,000 digits.
think days for a 3000 digit number, and roughly an hour for a
1000 digit number (half an hour on my XP 2000+ @ 1651)
> However, searchers of really big numbers do much quicker testsAnd should do so. Primo (the program linked above) uses an
> using one of Proth,PRP,LLR,Prime95, or PFGW.
algorithm that is general, and very heavily optimized, but
doesn't really take into account any special properties the
number may have (aside from some numbers I've seen which are
engineered specifically to test quickly under primo, but thats a
> Prime95.exe is used to test the primality of 2^p-1 (MersenneHowever, all the low (taking less than a week to several months)
> Numbers, p prime) ( and it can be used to factor 2^n+-1. ) It
> uses the Lucas- Lemer method.
numbers have been tested already for this very special form.
> LLR.exe ( Lucas Lemer Riesel ) tests numbers of the formNote that this, and the programs mentioned above, are definitive
> k*2^n-1 where k is fairly small ( say 10 digits I think. ) It
> says either a number is prime or it is not. ( It flies on a
> P4 computer. )
tests - and their results can thus be submitted to e.g. Prof
Caldwell's database. Some other tests are probabilistic - they
say a number is "very likely" prime. Generally, "very likely"
means much more likely than, for example, the event that I won't
die of a sudden brain aneurysm before I finish typing this
email. There's no real doubt about primality - but you
shouldn't submit numbers that haven't been proven to be prime,
as a matter of ethics.
> PRP.exe tests numbers of of the form k*2^n+-1 but does notAlso, it is now used somewhat less than PFGW. However, I
> prove them -- you would have to use another program to
> achieve that.
believe PRP has optimizations not yet available in PFGW, since
PRP is written by the same person who maintains the excellent
multiplication libraries used by both programs. This should not
make a huge difference though.
> Both LLR and PRP take the output from the trial divisionWhich, like any of the several other sieving programs available
> sieving program called NewPGen.
from this list's files area, may have rules for academic credit
which should be followed.
> PFGW.exe is a general purpose program with many switches suchIf you're in that situation, you might want to ask for help on
> as performing trial division etc. It can also understand
> NewPGen output. In it's factest mode it does a quick test but
> this does not give a certain answer, only a probable answer.
> If you can factor 33% of the number+-1 then PFGW can prove it
> prime. (If you can factor the number+-1 only to 30% then you
> can use KP but PFGW does not yet have this ability. )
this list. I don't understand the theory of a KP proof in much
> Proth.exe is excellent at testing numbers of the formAnd in fact it is one of the two fastest programs in the world
> E^(2^n)+1 where E is an even number -- so-called Generalized
> Fermat Numbers.
if you just want to find a large prime - the other being Prime95
and its ports. However, Generalized Fermat Numbers are
available in sizes which can be tested in minutes to hours - the
same is not true of untested Mersenne numbers for Prime95.
Question for the list - is Prime95 with the new Athlon
improvements in the beta versions now slightly better than
Proth? I don't use Proth much anymore.
> I took years with many people's computers to find the currentHowever, top 5000 primes can be found in a few hours.
> largest prime and it it will probablly take many more years
> to find the next!
> http://www.mersenne.org/prime.htmHowever, in the case of Proth and Primo, you will need to use
> http://groups.yahoo.com/group/primeform/files/ for PFGW.exe
> There are versions of these programs that run under both
> Windoze and Linux on PC's.
WINE or a similiar utility. I haven't seen a loss of efficienty
using such utilities.
Could this be the beginning of a FAQ?