Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function isPrime(n) {
var b = Math.sqrt(n);
if (Math.floor(b) == b) return false;
b = Math.floor(b);
while (b-- > 2) {
var a = n/b;
if (Math.floor(a) == a) return false;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.