calculate palindromes