OFFSET
0,14
COMMENTS
A004186(n) is the number formed when the digits of n are sorted nonincreasingly.
LINKS
David A. Corneth, Table of n, a(n) for n = 0..9999
FORMULA
a(10*n) = 10*a(n).
EXAMPLE
a(141) = (411 - 141)/9 = 30.
MATHEMATICA
s[n_]:= FromDigits@ Reverse@ Sort@ IntegerDigits@ n; a[n_]:=(s[n]-n)/9; Table[a[n], {n, 0, 89}] (* Indranil Ghosh, Feb 26 2017 *)
PROG
(PARI) a(n) = my(d = digits(n), v=vecsort(d, , 4)-d); sum(i=1, #v, v[i]*10^(#v-i)) / 9
(Python) def A283001(n): return (int("".join(sorted(str(n), reverse=True)))-n)/9 # Indranil Ghosh, Feb 26 2017
CROSSREFS
KEYWORD
AUTHOR
David A. Corneth, Feb 26 2017
STATUS
approved