cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A229623 Palindromes m such that m - sum_of_digits(m) is also a palindrome.

Original entry on oeis.org

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

Views

Author

Derek Orr, Sep 26 2013

Keywords

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.

Examples

			767 - (7+6+7) = 747 (another palindrome). So, 767 is in this sequence.
		

Crossrefs

Programs

  • 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 *)
  • PARI
    b(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)=my(d=digits(n));Vecrev(d)==d
    for(n=1,10^7,my(m=b(n), s=sumdigits(m));if(pal(m-s),print1(m,", "))) \\ Derek Orr, Apr 05 2015
  • 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