Search: id:A099009 Results 1-1 of 1 results found. %I A099009 %S A099009 0,495,6174,549945,631764,63317664,97508421,554999445,864197532, %T A099009 6333176664,9753086421,9975084201,86431976532,555499994445,633331766664, %U A099009 975330866421,997530864201,999750842001,8643319766532,63333317666664 %N A099009 List of 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. %C A099009 There are no seven-digit fixed points. %C A099009 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 (jens.k.a(AT)get2net.dk), Oct 04 2004 %C A099009 0's in n giving leading 0's in n'' is allowed. %C A099009 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. [From Vincenzo Librandi (vincenzo.librandi(AT)tin.it), Jan 05 2009] %H A099009 Joseph Myers, Table of n, a(n) for n=1..5344 %H A099009 Joseph Myers, List of cycles under Kaprekar map (all numbers with <= 60 digits; cycles are represented by their smallest value) %H A099009 Conrad Roche, Kaprekar Series Generator. %H A099009 Eric Weisstein's World of Mathematics, KaprekarRoutine %H A099009 Index entries for the Kaprekar map %e A099009 6174 is a fixed point of the mapping and hence a term: 6174 -> 7641 - 1467 = 6174. %o A099009 # Python (2.4) program from Tim Peters (Replace leading dots by blanks before running) %o A099009 .def extend(base, start, n): %o A099009 ... if n == 0: %o A099009 ....... yield base %o A099009 ....... return %o A099009 ... for i in range(start, 10): %o A099009 ....... for x in extend(base + str(i), i, n-1): %o A099009 ........... yield x %o A099009 .def drive(n): %o A099009 ... result = [] %o A099009 ... for lo in extend("", 0, n): %o A099009 ....... ilo = int(lo) %o A099009 ....... if ilo == 0 and n > 1: %o A099009 ........... continue %o A099009 ....... hi = lo[::-1] %o A099009 ....... diff = str(int(hi) - ilo) %o A099009 ....... diff = "0" * (n - len(diff)) + diff %o A099009 ....... if sorted(diff) == list(lo): %o A099009 ........... result.append(diff) %o A099009 ... return sorted(result) %o A099009 .for n in range(1, 17): %o A099009 ... print "Length", n %o A099009 ... print '-' * 40 %o A099009 ... for r in drive(n): %o A099009 ....... print r %Y A099009 Cf. A090429, A069746, A099010, A151959. %Y A099009 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). [From Joseph Myers (jsm(AT)polyomino.org.uk), Sep 05 2009] %Y A099009 Sequence in context: A164718 A151965 A151957 this_sequence A055160 A055157 A027808 %Y A099009 Adjacent sequences: A099006 A099007 A099008 this_sequence A099010 A099011 A099012 %K A099009 nonn,base %O A099009 1,2 %A A099009 Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), Sep 22 2004 %E A099009 More terms from Jens Kruse Andersen (jens.k.a(AT)get2net.dk) and Tim Peters (tim(AT)python.org), Oct 04 2004 %E A099009 Corrected by Jens Kruse Andersen (jens.k.a(AT)get2net.dk), Oct 25 2004 Search completed in 0.002 seconds