Mail Archives: djgpp/1997/11/27/01:22:49
Orlando Andico wrote:
>
> There is a method known as Rabin's test for primality. It does not
> guarantee that the number tested is prime, however, there is a very large
> chance that it is so.
>
> Select 100 numbers randomly from 1.. N (where N is the number to be tested
> for primality). See if N is factorable by any of the 100 numbers. If not,
> then it is prime.
>
> This might sound really stupid, but it actually works (most of the time).
> I got the idea from a book, "Out of their minds" which follows the
> discoveries of some great computer scientists (Djikstra, Rabin, the fellow
> who designed the Connection Machine, et al).
It's good method and can be improoved by checking Rabin's number in
usual way -
try to divide on each previous prime number.
--
Regards,
Dim Zegebart,
Moscow Russia.
Ghostly basement : http://www.geocities.com/siliconvalley/pines/7817
DZCOMM - comm library for Allegro
- Raw text -