Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Sheets custom formula to check for primality
/**
* @customfunction
*/
function ISPRIME(number) {
for (var i = 2; i <= Math.sqrt (number); i++) {
if(number % i === 0) {
return false;
}
}
return number > 1;
}
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.