You are viewing a single comment's thread. Return to all comments →
Can improve
for (int i = 2; i < (num/2)+1; i++){ if (num%i==0){ return false; } }
as
for (int i = 2; i*i <= num; i++){ if (num%i==0){ return false; } }
will be faster
Seems like cookies are disabled on this browser, please enable them to open this website
Prime Checker
You are viewing a single comment's thread. Return to all comments →
Can improve
as
will be faster