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

 

Logo

Invitation: celebrating 50 years of OEIS, 250000 sequences, and Sloane's 75th, there will be a conference at DIMACS, Rutgers, Oct 9-10 2014.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A099009 Fixed points of the Kaprekar mapping f(n) = n' - n'', where in n' the digits of n are arranged in descending, in n'' in ascending order. 38
0, 495, 6174, 549945, 631764, 63317664, 97508421, 554999445, 864197532, 6333176664, 9753086421, 9975084201, 86431976532, 555499994445, 633331766664, 975330866421, 997530864201, 999750842001, 8643319766532, 63333317666664 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

There are no seven-digit fixed points.

Let d(n) denote n repetitions of the digit d. The sequence includes the following for all n>=0: 5(n)499(n)4(n)5, 63(n)176(n)4, 8643(n)1976(n)532. - Jens Kruse Andersen, Oct 04 2004

0's in n giving leading 0's in n'' is allowed.

For every natural number n let n' and n" be the numbers obtained by arranging the digits of n into decreasing and increasing order, and let f(n)=n'-n". It is known that the number 6174 is invariant under this transformation and that applying f a certain number of times to a number n with four digits the numbers 0, 495 or 6174 are always reached. [Vincenzo Librandi, Nov 17 2010]

Each term of A055162(n) corresponds to A099009(n+1), with its digits being reordered in the ascending manner. [From Alexander R. Povolotsky, Apr 27 2012]

All terms of this sequence are divisible by nine, a(n)/9 = A132155(n). [Alexander R. Povolotsky, Apr 29 2012]

A055160 differs from this sequence only at the positions of two terms in it: 554999445 and 555499994445. [Alexander R. Povolotsky, May 01, 2012]

The union of the sequences A214555, A214556, A214557, A214558, A214559 and the element 0 gives the sequence A099009. [Syed Iddi Hasan, Jul 24 2012]

LINKS

Syed Iddi Hasan, Table of n, a(n) for n = 1..8924

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

Conrad Roche, Kaprekar Series Generator.

Eric Weisstein's World of Mathematics, Kaprekar Routine

Index entries for the Kaprekar map

EXAMPLE

6174 is a fixed point of the mapping and hence a term: 6174 -> 7641 - 1467 = 6174.

PROG

(Python)

# (version 2.4) from Tim Peters (Replace leading dots by blanks before running)

.def extend(base, start, n):

... if n == 0:

....... yield base

....... return

... for i in range(start, 10):

....... for x in extend(base + str(i), i, n-1):

........... yield x

.def drive(n):

... result = []

... for lo in extend("", 0, n):

....... ilo = int(lo)

....... if ilo == 0 and n > 1:

........... continue

....... hi = lo[::-1]

....... diff = str(int(hi) - ilo)

....... diff = "0" * (n - len(diff)) + diff

....... if sorted(diff) == list(lo):

........... result.append(diff)

... return sorted(result)

.for n in range(1, 17):

... print "Length", n

... print '-' * 40

... for r in drive(n):

....... print r

CROSSREFS

Cf. A090429, A069746, A099010, A151959, A055162, A132155, A055160.

In other bases: A163205 (base 2), A164997 (base 3), A165016 (base 4), A165036 (base 5), A165055 (base 6), A165075 (base 7), A165094 (base 8), A165114 (base 9).

Sequence in context: A164718 A151965 A151957 * A055160 A055157 A027808

Adjacent sequences:  A099006 A099007 A099008 * A099010 A099011 A099012

KEYWORD

nonn,base

AUTHOR

Klaus Brockhaus, Sep 22 2004

EXTENSIONS

More terms from Jens Kruse Andersen and Tim Peters (tim(AT)python.org), Oct 04 2004

Corrected by Jens Kruse Andersen, Oct 25 2004

STATUS

approved

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

Content is available under The OEIS End-User License Agreement .

Last modified July 30 02:02 EDT 2014. Contains 245051 sequences.