login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

Indranil Ghosh, Table of n, a(n) for n = 0..32768 (terms 0..4096 from Joseph Myers)

Index entries for the Kaprekar map

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]];

a /@ Range[0, 100] (* Jean-Fran├žois Alcover, Jan 08 2020 *)

PROG

(Python)

def A165090(n):

    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

Cf. A165091.

In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165110 (base 9), A151949 (base 10).

Sequence in context: A096444 A246918 A055957 * A117013 A176015 A322910

Adjacent sequences:  A165087 A165088 A165089 * A165091 A165092 A165093

KEYWORD

base,nonn

AUTHOR

Joseph Myers, Sep 04 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 29 19:26 EST 2020. Contains 338769 sequences. (Running on oeis4.)