login
A070837
Smallest number k such that abs(k - R(k)) = 9n, where R(k) is digit reversal of k (A004086); or 0 if no such k exists.
3
10, 13, 14, 15, 16, 17, 18, 19, 90, 1011, 100, 0, 0, 0, 0, 0, 0, 0, 0, 1021, 1090, 103, 0, 0, 0, 0, 0, 0, 0, 1031, 1080, 0, 104, 0, 0, 0, 0, 0, 0, 1041, 1070, 0, 0, 105, 0, 0, 0, 0, 0, 1051, 1060, 0, 0, 0, 106, 0, 0, 0, 0, 1061, 1050, 0, 0, 0, 0, 107, 0, 0, 0, 1071, 1040, 0, 0, 0, 0, 0
OFFSET
1,1
COMMENTS
If 9n < 1000, k has at most 5 digits, and abs(k - R(k)) = 9n, then 10 must divide n. - Sascha Kurz, Jan 02 2003
MATHEMATICA
a = Table[0, {50}]; Do[d = Abs[n - FromDigits[ Reverse[ IntegerDigits[n]]]] / 9; If[d < 51 && a[[d]] == 0, a[[d]] = n], {n, 1, 10^7}]; a
PROG
(Python)
def back_difference(n):
r = int(str(n)[::-1])
return abs(r-n)
def a070837(n):
i = 0
while True:
if back_difference(i)==9*n:
return i
i+=1
# Christian Perfect, Jul 23 2015
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, May 12 2002
EXTENSIONS
More terms from Sascha Kurz, Jan 02 2003
a(21) corrected by Christian Perfect, Jul 23 2015
STATUS
approved