login
A165110
a(n) = image of n under the base-9 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order)
31
0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 16, 24, 32, 40, 48, 56, 16, 8, 0, 8, 16, 24, 32, 40, 48, 24, 16, 8, 0, 8, 16, 24, 32, 40, 32, 24, 16, 8, 0, 8, 16, 24, 32, 40, 32, 24, 16, 8, 0, 8, 16, 24, 48, 40, 32, 24, 16, 8, 0, 8, 16, 56, 48, 40, 32, 24, 16, 8, 0, 8, 64, 56, 48, 40, 32, 24, 16, 8
OFFSET
0,10
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..59049 (terms 0..6561 from Joseph Myers)
EXAMPLE
For n = 11, 11_10 = 12_9. So, a(11) = 21_9 - 12_9 = 19 - 11 = 8. - Indranil Ghosh, Feb 02 2017
MATHEMATICA
a[n_] := With[{dd = IntegerDigits[n, 9]}, FromDigits[ReverseSort[dd], 9] - FromDigits[Sort[dd], 9]];
a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)
CROSSREFS
Cf. A165111.
In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A151949 (base 10).
Sequence in context: A200513 A200523 A118540 * A055959 A341485 A076350
KEYWORD
base,nonn
AUTHOR
Joseph Myers, Sep 04 2009
STATUS
approved