fix the algorithm in the isprime example

The old version of isprime would return false for 2 and return true for any n with no factor less than sqrt(n).

These alterations fix that.