login
A229623
Palindromes m such that m - sum_of_digits(m) is also a palindrome.
0
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 101, 181, 262, 343, 424, 686, 767, 848, 929, 1001, 10001, 100001, 1000001, 10000001, 100000001, 1000000001, 10000000001, 100000000001, 1000000000001
OFFSET
1,3
COMMENTS
It is conjectured that a(n) = 10^(n-18) + 1 for all n > 20. - Derek Orr, Apr 05 2015
Palindromes in the sequence A229621.
EXAMPLE
767 - (7+6+7) = 747 (another palindrome). So, 767 is in this sequence.
MATHEMATICA
palQ[n_]:=Module[{idn=IntegerDigits[n], idn2}, idn2=IntegerDigits[n - Total[idn]]; idn==Reverse[idn]&&idn2==Reverse[idn2]]; Select[Range[0, 2 10^6], palQ] (* Vincenzo Librandi, Apr 06 2015 *)
PROG
(Python)
def pal(n):
..r = ''
..for i in str(n):
....r = i + r
..return r == str(n)
def DS(n):
..s = 0
..for i in str(n):
....s += int(i)
..return s
{print(n, end=', ') for n in range(10**6) if pal(n) and pal(n-DS(n))}
## Simplified by Derek Orr, Apr 05 2015
(PARI) a(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])} \\ Code from David A. Corneth in A002113, Jun 06 2014
pal(n)=d=digits(n); Vecrev(d)==d
for(n=1, 10^7, s=sumdigits(a(n)); if(pal(a(n)-s), print1(a(n), ", "))) \\ Derek Orr, Apr 05 2015
CROSSREFS
Sequence in context: A064704 A083136 A369127 * A277856 A117057 A249516
KEYWORD
nonn,base
AUTHOR
Derek Orr, Sep 26 2013
STATUS
approved