Skip to content

Instantly share code, notes, and snippets.

@xetorthio
Created February 1, 2012 08:11
Show Gist options
  • Save xetorthio/1715910 to your computer and use it in GitHub Desktop.
Save xetorthio/1715910 to your computer and use it in GitHub Desktop.
function isPrime(n) {
if (n<2) return false;
if (n==2) return true;
for (var i=2; i<n; i++) { if (n%i==0) return false; }
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment