[go: up one dir, main page]

login
A229621
Numbers n such that n - (sum of digits of n) is a palindrome.
3
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,3
EXAMPLE
185 - (1+8+5) = 171 (a palindrome). Thus, 185 is a member of this sequence.
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**3) if ispal(n-DS(n))}
## Simplified by Derek Orr, Apr 10 2015
(PARI) ispal(d) = Vecrev(d) == d;
isok(n) = ispal(digits(n-sumdigits(n))); \\ Michel Marcus, Apr 11 2015
CROSSREFS
Cf. A066568.
Sequence in context: A067080 A008554 A055644 * A077342 A242474 A351374
KEYWORD
nonn,base,easy
AUTHOR
Derek Orr, Sep 26 2013
EXTENSIONS
More terms from Derek Orr, Apr 10 2015
STATUS
approved