Skip to content

Instantly share code, notes, and snippets.

@platedodev
Created September 13, 2017 02:05
Show Gist options
  • Save platedodev/dc6610698413e43451fd5d8eb8b89389 to your computer and use it in GitHub Desktop.
Save platedodev/dc6610698413e43451fd5d8eb8b89389 to your computer and use it in GitHub Desktop.
Kata - Twin Prime
function isTwinPrime(n){
return (isPrime(n) && (isPrime(n-2) || isPrime(n+2)));
}
function isPrime(n) {
for (var i = 2; i < n; i++) if (n % i == 0) return false;
return n >= 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment