Skip to content

Instantly share code, notes, and snippets.

@adambom
Created June 29, 2012 21:05
Show Gist options
  • Save adambom/3020651 to your computer and use it in GitHub Desktop.
Save adambom/3020651 to your computer and use it in GitHub Desktop.
Largest prime palindrome under a max
function findLargestPrimePalindrome(max) {
if (max === 0) {
return null;
}
if (isPalindrome(max) && isPrime(max)) {
return max;
}
return findLargestPrimePalindrome(max - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment