Hi.

I spent all morning thinking of an algorithm that could tell weather a Number K is prime or not.

Ii came out the following formula:

1..... Kz=-y(1+z)

where 0 < z <K-1 and 0 > y >1-K, and z and y are even.

If there is a pair (x,y) that satisfies 1., then K is not prime, otherwise, it is prime.

I timed the following numbers:

number prime time

23451 NO 3 min. 3 sec. 432 milliseconds.

5737 YES 0 min. 10 sec. 172 milliseconds

The question is: Does anyone has a routine that times this?

Im using APL as my programming language. I would like to see if C is faster.

(APL is an interpreter)

Thanks.

Gustavo.