[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A319387 Smallest palindrome p such that n-p is again a palindrome, or n if no such p exists. 1

%I #20 Sep 19 2018 02:58:23

%S 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,

%T 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,

%U 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

%N Smallest palindrome p such that n-p is again a palindrome, or n if no such p exists.

%C a(n) = n if and only if A262087(n) = 0.

%H Robert Israel, <a href="/A319387/b319387.txt">Table of n, a(n) for n = 0..10000</a>

%e a(11) = 0 because 11 = 11 + 0, so 0 is the smallest palindrome in any partitioning of 11 as a sum of two palindromes.

%e a(21) = 21 because 21 cannot be written as a sum of two palindromes.

%p isP := k -> StringTools[IsPalindrome](convert(k,string)):

%p a := NULL:

%p for n from 0 to 99 do

%p an := n:

%p for k from 0 to n/2 do

%p if isP(k) and isP(n-k) then an := min(an,k) end if

%p end do:

%p a := a,an

%p end do:

%p a;

%Y Cf. A002113, A035137, A260254, A262087.

%K nonn,base,look

%O 0,14

%A _Markus Sigg_, Sep 18 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 23:34 EDT 2024. Contains 375520 sequences. (Running on oeis4.)