math palindrome code