login
This site is supported by donations to The OEIS Foundation.

 

Logo

"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A151949 a(n) = image of n under the Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order). 50
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 9, 18, 27, 36, 45, 54, 63, 72, 18, 9, 0, 9, 18, 27, 36, 45, 54, 63, 27, 18, 9, 0, 9, 18, 27, 36, 45, 54, 36, 27, 18, 9, 0, 9, 18, 27, 36, 45, 45, 36, 27, 18, 9, 0, 9, 18, 27, 36, 54, 45, 36, 27, 18, 9, 0, 9, 18, 27, 63, 54, 45, 36, 27 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,11

COMMENTS

Entries are multiples of 9 - see A151950.

a(n) =  A004186(n) - A004185(n); a(A010785(n)) = 0. - Reinhard Zumkeller, corrected: Mar 23 2015, Jul 09 2013

LINKS

Indranil Ghosh, Table of n, a(n) for n = 0..20000 (terms 0..1000 from Joseph Myers and Robert G. Wilson v)

H. Hanslik, E. Hetmaniok, I. Sobstyl, et al., Orbits of the Kaprekar's transformations-some introductory facts, Zeszyty Naukowe Politechniki Śląskiej, Seria: Matematyka Stosowana z. 5, Nr kol. 1945; 2015.

R. J. Mathar, Maple code for A151949 and A151959

Joseph Myers, C program for computing sequences related to the Kaprekar map

Joseph Myers, List of cycles under Kaprekar map (all numbers with <= 60 digits; cycles are represented by their smallest value)

Index entries for the Kaprekar map

FORMULA

a(n) = abs(n - Sum_{k = 0, floor(log10(n))}(floor(n/10^k) - 10*floor(n/10^(k + 1)))*10^(floor(log10(n)) - k)). - José de Jesús Camacho Medina, Mar 23 2014

EXAMPLE

For n = 15, a(15) = 51 - 15 = 36. - Indranil Ghosh, Feb 01 2017

MATHEMATICA

f[n_] := Module[{idn = IntegerDigits@n, idns}, idns = Sort@ idn; FromDigits@ Reverse@ idns - FromDigits@ idns]; Table[ f@n, {n, 0, 200}] (* Harvey P. Dale, Aug 18 2009 *)

Flatten[Table[Differences[FromDigits /@ {y = Sort[x = IntegerDigits[n]], Reverse[y]}], {n, 0, 74}]] (* Jayanta Basu, Jul 11 2013 *)

Abs[Table[n, {n, 999}] - Table[Sum[(Floor[n/10^k] - 10 * Floor[n/10^(k + 1)]) * 10^(Floor[Log[10, n]] - k), {k, 0, Floor[Log[10, n]]}], {n, 999}]] (* José de Jesús Camacho Medina, Mar 23 2014 *)

PROG

(Haskell)

a151949 n = a004186 n - a004185 n

-- Reinhard Zumkeller, corrected: Mar 23 2015, Jul 09 2013

(Python)

def A151949(n):

....return int("".join(sorted(str(n), reverse=True)))-int("".join(sorted(str(n)))) # Indranil Ghosh, Feb 01 2017

CROSSREFS

In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9). - Joseph Myers, Sep 05 2009

Cf. A151959, A069746.

Cf. A004185, A004186, A099009 (fixed points).

Sequence in context: A242400 A197264 A273086 * A056965 A062047 A117465

Adjacent sequences:  A151946 A151947 A151948 * A151950 A151951 A151952

KEYWORD

nonn,base

AUTHOR

N. J. A. Sloane, Aug 18 2009

EXTENSIONS

More terms from Robert G. Wilson v, Aug 19 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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified August 21 07:08 EDT 2017. Contains 290862 sequences.