In a message dated 9/2/2005 8:44:16 PM Pacific Daylight Time, 
[EMAIL PROTECTED] writes:


> INPUT ANS
> MAX=INT(SQRT(ANS))+1
> PRIME=TRUE
> FOR I=2 TO MAX UNTIL NOT PRIME
>       IF MOD(ANS,I)=0 THEN PRIME=FALSE
> NEXT I

You don't need to add "1" Mark.
If sqrt is already an int then that is your proof that it's not prime
If sqrt is *not* an int then for any factor which exists greater than sqrt, 
there must be a factor less than sqrt.

Thus you will encounter a factor somewhere from 2 to int(sqrt) without the 
need to add '1' to it.

Will
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to