>I think there's a large prize awaiting anyone who can prove a number prime without using brute force (perhaps more precisely, to create a formula which will unfailingly generate primes), which, I'm afraid, that algorithm is only capable of.
>
>So, maybe there's a practical benefit to theoretical math after all!
>
>
> Jay
hi Jay
i am not that verse in Math, and i proppably missunderstood you, but is this what you're looking for (there is a website with primenumbers at
http://www.utm.edu/research/primes/lists/small/1000.txt): -)
CLEAR
FOR i=1 TO 4060
IF IsPrime(i) = .T.
?i
ENDIF
ENDFOR
RETURN
FUNC IsPrime(Num2Check)
LOCAL ;
xi, ;
TargetLoop, ;
ReturnValue
ReturnValue = .T.
TargetLoop = ROUND(Num2Check/2, 0)
FOR xi=2 TO TargetLoop
IF MOD(Num2Check, xi) = 0
ReturnValue = .F.
EXIT
ENDIF
ENDFOR
RETURN(ReturnValue)
ENDFUNC