You are viewing a single comment's thread. Return to all comments →
To avoid the i*i calculus in each loop:
long maxDivider = Math.round(Math.sqrt(number)); for (int divider = 2; divider <= maxDivider; divider++) { if (number % divider == 0) { return false; } }
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 →
To avoid the i*i calculus in each loop: