|
|
A165090
|
|
a(n) is the image of n under the base-8 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, 7, 0, 7, 14, 21, 28, 35, 42, 14, 7, 0, 7, 14, 21, 28, 35, 21, 14, 7, 0, 7, 14, 21, 28, 28, 21, 14, 7, 0, 7, 14, 21, 35, 28, 21, 14, 7, 0, 7, 14, 42, 35, 28, 21, 14, 7, 0, 7, 49, 42, 35, 28, 21, 14, 7, 0, 63, 63, 126, 189, 252, 315, 378, 441, 63, 0, 63, 126, 189
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,9
|
|
LINKS
|
|
|
EXAMPLE
|
For n = 11, 11_10 = 13_8. So, a(11) = 31_8 - 13_8 = 25 - 11 = 14. - Indranil Ghosh, Feb 02 2017
|
|
MATHEMATICA
|
a[n_] := With[{dd = IntegerDigits[n, 8]}, FromDigits[ReverseSort[dd], 8] - FromDigits[Sort[dd], 8]];
|
|
PROG
|
(Python)
if n==0:return 0
return int("".join(sorted(oct(n)[2:], reverse=True)), 8)-int("".join(sorted(oct(n)[2:])), 8) # Indranil Ghosh, Feb 02 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|