%I #39 Mar 17 2023 02:33:02
%S 0,1,2,3,4,181,191,262,343,424,505,696,767,848,929,28999999999982,
%T 37999999999973,46999999999964,55999999999955,64999999999946,
%U 73999999999937,82999999999928,91999999999919,1099999999999901
%N Palindromes m such that m + (sum of digits of m) is also a palindrome.
%C Palindromes in A229545.
%C This sequence is infinite. It is possible to generate an infinite subsequence using 1099999999999901 as a model. Look at palindromes of the form: 1, z zeros, floor(11*10^z/9) nines, z zeros, 1. The sum of the digits is 11*10^z. Adding 11*10^z to the number produces a palindrome having 4 ones. - _T. D. Noe_, Oct 03 2013
%e 262 + (2+6+2) = 272 (another palindrome). So 262 is in this sequence.
%t isPal[d_List] := d[[1]] != 0 && d == Reverse[d]; check[d_List] := Module[{num = FromDigits[d]}, If[isPal[IntegerDigits[num + Total[d]]], Print[num]; AppendTo[t, num];]]; t = {0}; Do[d = IntegerDigits[n]; dig = Join[d, Reverse[d]]; check[dig]; dig = Join[d, Reverse[Most[d]]]; check[dig], {n, 0, 9999999}]; Sort[t] (* _T. D. Noe_, Oct 02 2013 *)
%o (Python)
%o def ispal(n):
%o r = ''
%o for i in str(n):
%o r = i + r
%o return n == int(r)
%o def DS(n):
%o s = 0
%o for i in str(n):
%o s += int(i)
%o return s
%o {print(n,end=', ') for n in range(10**7) if ispal(n) and ispal(n+DS(n))}
%o # Simplified by _Derek Orr_, Apr 10 2015
%o # Fixed by _Robert C. Lyons_, Mar 16 2023
%Y Cf. A002113, A104459, A229545.
%K nonn,base
%O 1,3
%A _Derek Orr_, Sep 26 2013
%E 1099999999999901 from _T. D. Noe_, Oct 03 2013
|