This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A164993 #15 Jun 02 2025 01:54:09 %S A164993 0,0,0,2,0,2,4,2,0,8,8,16,8,0,8,16,8,8,16,16,16,16,8,8,16,8,0,26,32, %T A164993 58,32,26,52,58,52,58,32,26,52,26,0,26,52,26,32,58,52,58,52,26,32,58, %U A164993 32,26,52,58,64,58,52,58,64,58,52,58,52,58,52,26,32,58,32,26,64,58,52,58,32 %N A164993 a(n) = image of n under the base-3 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order). %H A164993 Indranil Ghosh, <a href="/A164993/b164993.txt">Table of n, a(n) for n = 0..19683</a> (terms 0..2187 from Joseph Myers) %H A164993 <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a> %e A164993 For n = 10, 10_10 = 101_3. So, a(10) = 110_3 - 11_3 = 12 - 4 = 8. - _Indranil Ghosh_, Feb 02 2017 %t A164993 a[n_] := With[{dd = IntegerDigits[n, 3]}, FromDigits[ReverseSort[dd], 3] - FromDigits[Sort[dd], 3]]; %t A164993 a /@ Range[0, 100] (* _Jean-François Alcover_, Jan 08 2020 *) %Y A164993 Cf. A164994. %Y A164993 In other bases: A164884 (base 2), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10). %K A164993 base,nonn %O A164993 0,4 %A A164993 _Joseph Myers_, Sep 04 2009