A261675 Minimal number of palindromes in base 10 that add to n.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 1, 2, 2, 2, 2
Offset: 0
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..10000
- Javier Cilleruelo and Florian Luca, Every positive integer is a sum of three palindromes, arXiv preprint arXiv:1602.06208 [math.NT], 2016.
- William D. Banks, Every natural number is the sum of forty-nine palindromes, INTEGERS 17 (2016), 9 pp.
- James Grime and Brady Haran, Every Number is the Sum of Three Palindromes (2018), Numberphile video
Programs
-
PARI
ispal(n)=my(d=digits(n)); d==Vecrev(d); a(n)=my(L=n\2,d,e); if(ispal(n), return(1)); d=[1]; while((e=fromdigits(d))<=L, if(ispal(n-e), return(2)); my(k=#d,i=(k+1)\2); while(i&&d[i]==9, d[i]=0; d[k+1-i]=0; i--); if(i, d[i]++; d[k+1-i]=d[i], d=vector(#d+1); d[1]=d[#d]=1)); 3; \\ Charles R Greathouse IV, Nov 12 2018
Comments