06-03-2003, 04:32 AM
Quote:this works well enough for me.
Code:INPUT number&
FOR y& = 1 TO number&
prime% = 0
FOR x& = 2 TO SQR(y&) - 1
IF y& / x& = y& \ x& THEN prime% = 1
NEXT x&
IF prime% = 0 THEN PRINT y&
NEXT y&
I hope you don't think I picking on you...your code pegs 25, 49, and 121 as prime...all have prime roots, but they themselves are not prime...I hope this isn't good enough for you!!! :-?