[go: up one dir, main page]

login
A229622
Palindromes m such that m + (sum of digits of m) is also a palindrome.
0
0, 1, 2, 3, 4, 181, 191, 262, 343, 424, 505, 696, 767, 848, 929, 28999999999982, 37999999999973, 46999999999964, 55999999999955, 64999999999946, 73999999999937, 82999999999928, 91999999999919, 1099999999999901
OFFSET
1,3
COMMENTS
Palindromes in A229545.
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
EXAMPLE
262 + (2+6+2) = 272 (another palindrome). So 262 is in this sequence.
MATHEMATICA
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 *)
PROG
(Python)
def ispal(n):
r = ''
for i in str(n):
r = i + r
return n == int(r)
def DS(n):
s = 0
for i in str(n):
s += int(i)
return s
{print(n, end=', ') for n in range(10**7) if ispal(n) and ispal(n+DS(n))}
# Simplified by Derek Orr, Apr 10 2015
# Fixed by Robert C. Lyons, Mar 16 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Derek Orr, Sep 26 2013
EXTENSIONS
1099999999999901 from T. D. Noe, Oct 03 2013
STATUS
approved