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.

A229621 Numbers n such that n - (sum of digits of n) is a palindrome.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 420, 421, 422, 423, 424, 425, 426
Offset: 1

Views

Author

Derek Orr, Sep 26 2013

Keywords

Examples

			185 - (1+8+5) = 171 (a palindrome). Thus, 185 is a member of this sequence.
		

Crossrefs

Cf. A066568.

Programs

  • Mathematica
    Select[Range[0,500],PalindromeQ[#-Total[IntegerDigits[#]]]&]
  • PARI
    ispal(d) = Vecrev(d) == d;
    isok(n) = ispal(digits(n-sumdigits(n))); \\ Michel Marcus, Apr 11 2015
  • 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**3) if ispal(n-DS(n))}
    ## Simplified by Derek Orr, Apr 10 2015
    

Extensions

More terms from Derek Orr, Apr 10 2015