A319387 Smallest palindrome p such that n-p is again a palindrome, or n if no such p exists.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 32, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 54, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 76, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 87, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 98, 0
Offset: 0
Examples
a(11) = 0 because 11 = 11 + 0, so 0 is the smallest palindrome in any partitioning of 11 as a sum of two palindromes. a(21) = 21 because 21 cannot be written as a sum of two palindromes.
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
Maple
isP := k -> StringTools[IsPalindrome](convert(k,string)): a := NULL: for n from 0 to 99 do an := n: for k from 0 to n/2 do if isP(k) and isP(n-k) then an := min(an,k) end if end do: a := a,an end do: a;
Comments