A165071 a(n) = image of n under the base-7 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).
0, 0, 0, 0, 0, 0, 0, 6, 0, 6, 12, 18, 24, 30, 12, 6, 0, 6, 12, 18, 24, 18, 12, 6, 0, 6, 12, 18, 24, 18, 12, 6, 0, 6, 12, 30, 24, 18, 12, 6, 0, 6, 36, 30, 24, 18, 12, 6, 0, 48, 48, 96, 144, 192, 240, 288, 48, 0, 48, 96, 144, 192, 240, 96, 48, 48, 96, 144, 192, 240, 144, 96, 96, 96
Offset: 0
Examples
For n = 11, 11_10 = 14_7. So, a(11) = 41_7 - 14_7 = 29 - 11 = 18. - _Indranil Ghosh_, Feb 02 2017
Links
- Indranil Ghosh, Table of n, a(n) for n = 0..16807 (terms 0..2401 from Joseph Myers)
- Index entries for the Kaprekar map
Crossrefs
Programs
-
Mathematica
a[n_] := With[{dd = IntegerDigits[n, 7]}, FromDigits[ReverseSort[dd], 7] - FromDigits[Sort[dd], 7]]; a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)