OFFSET
0,4
LINKS
Indranil Ghosh, Table of n, a(n) for n = 0..19683 (terms 0..2187 from Joseph Myers)
EXAMPLE
For n = 10, 10_10 = 101_3. So, a(10) = 110_3 - 11_3 = 12 - 4 = 8. - Indranil Ghosh, Feb 02 2017
MATHEMATICA
a[n_] := With[{dd = IntegerDigits[n, 3]}, FromDigits[ReverseSort[dd], 3] - FromDigits[Sort[dd], 3]];
a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Joseph Myers, Sep 04 2009
STATUS
approved