login
Numbers that are not the sum of 2 palindromes (where 0 is considered a palindrome).
21

%I #54 Aug 11 2024 14:41:30

%S 21,32,43,54,65,76,87,98,201,1031,1041,1042,1051,1052,1053,1061,1062,

%T 1063,1064,1071,1072,1073,1074,1075,1081,1082,1083,1084,1085,1086,

%U 1091,1092,1093,1094,1095,1096,1097,1099,1101,1103,1104,1105,1106,1107,1108

%N Numbers that are not the sum of 2 palindromes (where 0 is considered a palindrome).

%C Apparently, every positive number is equal to the sum of at most 3 positive palindromes. - _Giovanni Resta_, May 12 2013

%C A260254(a(n)) = 0. - _Reinhard Zumkeller_, Jul 21 2015

%C A261675(a(n)) >= 3 (and, conjecturally, = 3). - _N. J. A. Sloane_, Sep 03 2015

%C This sequence is infinite. Proof: It is easy to see that 200...01 (with any number of zeros) cannot be the sum of two palindromes. - _N. J. A. Sloane_, Sep 03 2015

%C The conjecture that every number is the sum of 3 palindromes fails iff there is a term a(n) such that for all palindromes P < a(n), the difference a(n) - P is also a term of this sequence. - _M. F. Hasler_, Sep 08 2015

%C Cilleruelo and Luca (see links) have proved the conjecture that every positive integer is the sum of at most three palindromes (in bases >= 5), and also that the density of those that require three is positive. - _Christopher E. Thompson_, Apr 14 2016

%H David W. Wilson, <a href="/A035137/b035137.txt">Table of n, a(n) for n = 1..10000</a>

%H Javier Cilleruelo and Florian Luca, <a href="http://arxiv.org/abs/1602.06208">Every positive integer is a sum of three palindromes</a>, arXiv:1602.06208 [math.NT], 2016.

%H P. De Geest, <a href="https://www.worldofnumbers.com/index.html">World!Of Numbers</a>

%H Hugo Pfoertner, <a href="/A035137/a035137.png">Plot of first 10^6 terms</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PalindromicNumber.html">Palindromic Number</a>

%p N:= 4: # to get all terms with <= N digits

%p revdigs:= proc(n) local L,j,nL;

%p L:= convert(n,base,10); nL:= nops(L);

%p add(L[j]*10^(nL-j),j=1..nL);

%p end proc;

%p palis:= $0..9:

%p for d from 2 to N do

%p if d::even then

%p palis:= palis, seq(x*10^(d/2)+revdigs(x),x=10^(d/2-1)..10^(d/2)-1)

%p else

%p palis:= palis, seq(seq(x*10^((d+1)/2)+y*10^((d-1)/2)+revdigs(x),y=0..9),x=10^((d-3)/2)..10^((d-1)/2)-1);

%p fi

%p od:

%p palis:= [palis]:

%p A:= Array(0..10^N-1):

%p A[palis]:= 1:

%p B:= SignalProcessing:-Convolution(A,A):

%p select(t -> B[t+1] < 0.5, [$1..10^N-1]); # _Robert Israel_, Jun 22 2015

%t palQ[n_]:=FromDigits[Reverse[IntegerDigits[n]]]==n; nn=1108; t={}; Do[i=c=0; While[i<=n && c!=1,If[palQ[i] && palQ[n-i], AppendTo[t,n]; c=1]; i++],{n,nn}]; Complement[Range[nn],t] (* _Jayanta Basu_, May 12 2013 *)

%o (Haskell)

%o a035137 n = a035137_list !! (n-1)

%o a035137_list = filter ((== 0) . a260254) [0..]

%o -- _Reinhard Zumkeller_, Jul 21 2015

%o (PARI) is_A035137(n)={my(k=0);!until(n<2*k=nxt(k),is_A002113(n-k)&&return)} \\ Uses function nxt() given in A002113. Not very efficient for large n, better start with k=n-A261423(n). Maybe also better use A261423 rather than nxt(). - _M. F. Hasler_, Jul 21 2015

%Y Cf. A014091, A014092, A104444.

%Y Cf. A260254, A260255 (complement), A002113, A261906, A261907.

%Y Cf. A319477 (disallowing zero).

%K nonn,base

%O 1,1

%A _Patrick De Geest_, Nov 15 1998