cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 16 results. Next

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.

Original entry on oeis.org

0, 495, 6174, 549945, 631764, 63317664, 97508421, 554999445, 864197532, 6333176664, 9753086421, 9975084201, 86431976532, 555499994445, 633331766664, 975330866421, 997530864201, 999750842001, 8643319766532, 63333317666664
Offset: 1

Views

Author

Klaus Brockhaus, Sep 22 2004

Keywords

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. - 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
The comment made by Jens Kruse Andersen is missing one more family of terms (which starts with one or more digits "9" and ends with the digit "1"): 97508421, 9753086421, 9975084201, 975330866421, 997530864201, 999750842001, ... This family could be generalized (using the same method as in Andersen's comment) and it is actually covered by Syed Iddi Hasan in A214559. Also A214557 and A214558 (both - by Syed Iddi Hasan) are variants of Andersen's 8643(n)1976(n)532. - Alexander R. Povolotsky, Mar 14 2015
Fixed points of A151949. - Reinhard Zumkeller, Mar 23 2015

Examples

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

Crossrefs

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).

Programs

  • Haskell
    a099009 n = a099009_list !! (n-1)
    a099009_list = [x | x <- [0..], a151949 x == x]
    -- Reinhard Zumkeller, Mar 23 2015
    
  • Magma
    a:=func; [k:k in [0..10^7]|a(k)]; // Marius A. Burtea, Sep 12 2019
  • Mathematica
    f[n_] := Block[{d = IntegerDigits@ n, a, b}, a = FromDigits@ Sort@ d; b = FromDigits@ Reverse@ Sort@ d; n == b - a]; Select[Range@ 1000000, f] (* Michael De Vlieger, Mar 20 2015 *)
  • Python
    # (version 2.4) from Tim Peters
    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, end=', ')
    

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

A163205 The non-repetitive Kaprekar binary numbers in decimal.

Original entry on oeis.org

0, 9, 21, 45, 49, 93, 105, 189, 217, 225, 381, 441, 465, 765, 889, 945, 961, 1533, 1785, 1905, 1953, 3069, 3577, 3825, 3937, 3969, 6141, 7161, 7665, 7905, 8001, 12285, 14329, 15345, 15841, 16065, 16129, 24573, 28665, 30705, 31713, 32193, 32385
Offset: 1

Views

Author

Damir Olejar, Jul 23 2009

Keywords

Comments

Same as A160761, but with no repetitions. The numbers also exist in A143088, except that every first and last number is omitted from A143088's pyramid.
From Joseph Myers, Aug 29 2009: (Start)
Note that all base-2 cycles are fixed points.
Initial terms in base 2: 0, 1001, 10101, 101101, 110001, 1011101, 1101001, 10111101, 11011001, 11100001. (End)

Examples

			The number 9 is 1001 in binary. The maximum number using the same number of 0's and 1's is found and the minimum number having the same number of 0's and 1's is found to obtain the equation such as 1100 - 0011 = 1001. Repeating the same procedure gives us the same number and pattern of 0's and 1's. Therefore 9 is one of the Kaprekar numbers. If 9 did not occur before, it is counted as a number that belongs to a sequence and added to a database to skip repetitions. Numbers that end the procedure in 0 are excluded since they are not Kaprekar numbers. A number 9 can also be obtained with, let's say, 1100. Since number 9 already occurred for 1001, the number 9 occurring for 1100 is ignored to avoid repetition.
		

References

  • M. Charosh, Some Applications of Casting Out 999...'s, Journal of Recreational Mathematics 14, 1981-82, pp. 111-118.
  • D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., 13 (1980-1981), pp. 81-82.

Crossrefs

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

Programs

  • Java
    import java.util.*; class pattern { public static void main(String args[]) { int mem1 = 0; int mem2 =1; ArrayList memory = new ArrayList(); for (int i = 1; i
    				
  • Mathematica
    nmax = 10^5; f[n_] := Module[{id, sid, min, max}, id = IntegerDigits[n, 2]; min = FromDigits[sid = Sort[id], 2]; max = FromDigits[Reverse[sid], 2]; max - min]; Reap[Do[If[(fpn = FixedPoint[f, n]) > 0, Sow[fpn]], {n, 0, nmax}]][[2, 1]] // Union // Prepend[#, 0]& (* Jean-François Alcover, Apr 23 2017 *)

Formula

1. Sort all integers from the number in descending order.
2. Sort all integers from the number in ascending order.
3. Subtract ascending from descending order to obtain a new number.
4. Repeat the steps 1-3 with a new number until a repetitive sequence is obtained or until a zero is obtained.
5. Call the repetitive sequence's number a Kaprekar number, ignore zeros and repetitions from the set of the final results.

Extensions

Initial zero added for consistency with other bases by Joseph Myers, Aug 29 2009

A165095 Consider the base-8 Kaprekar map n->K(n) defined in A165090. Sequence gives numbers belonging to cycles, including fixed points.

Original entry on oeis.org

0, 21, 252, 1022, 1589, 2044, 2212, 2723, 3122, 3178, 3290, 17892, 20475, 21483, 21987, 25578, 26586, 102837, 147420, 177443, 213402, 217938, 1445787, 1449819, 1646442, 1707930, 1711962, 1715994, 1740690, 1752786, 1777482, 1941345
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 8: 0, 25, 374, 1776, 3065, 3774, 4244, 5243, 6062, 6152.

Crossrefs

In other bases: A163205 (base 2), A164998 (base 3), A165017 (base 4), A165037 (base 5), A165056 (base 6), A165076 (base 7), A165115 (base 9), A164716 (base 10).

A165016 List of fixed points of the base-4 Kaprekar map A165012.

Original entry on oeis.org

0, 30, 201, 2550, 3369, 3873, 14565, 54441, 62625, 64641, 171990, 234405, 254865, 873129, 954261, 1004193, 1036929, 1044993, 3755685, 4083345, 4165185, 11140950, 13978281, 15285909, 16075425, 16399953, 16599681, 16730625, 16762881
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 4: 0, 132, 3021, 213312, 310221, 330201, 3203211, 31102221, 33102201, 33302001.

Crossrefs

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

A165055 List of fixed points of the base-6 Kaprekar map A165051.

Original entry on oeis.org

0, 105, 5600, 27195, 33860, 42925, 1275170, 1657225, 6018495, 45962330, 47681900, 56319925, 60331825, 277695950, 348285175, 1305060855, 2151904825, 2175976225, 10363227560, 12973622725, 59994427550, 60063064790, 73115587525
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 6: 0, 253, 41532, 325523, 420432, 530421, 43155322, 55304201, 332555223, 4321044322.

Crossrefs

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

A164997 List of fixed points of the base-3 Kaprekar map A164993.

Original entry on oeis.org

0, 184, 2008, 5332, 19144, 55360, 146488, 175528, 520372, 1502344, 1589464, 3975844, 4749760, 14072968, 14334328, 40625344, 42947092, 107527864, 128312344, 129096424, 380156356, 387121600, 1097424568, 1159778008
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 3: 0, 20211, 2202101, 21022111, 222021001, 2210221101, 21102221111, 22220210001, 222102211001, 2211022211101.

Crossrefs

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

A165036 List of fixed points of the base-5 Kaprekar map A165032.

Original entry on oeis.org

0, 8, 392, 1831056, 48217776, 1217651376, 30502319376, 144640604656, 762863159376, 3774960835776, 19073104859376, 95168749491376, 476835250859376, 2383192380269376, 11320075681132656, 11920919418359376
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 5: 0, 13, 3032, 432043211, 44320432101, 4443204321001, 444432043210001, 4332210443322111, 44444320432100001, 443322104433221101.

Crossrefs

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

A165075 List of fixed points of the base-7 Kaprekar map A165071.

Original entry on oeis.org

0, 1922263344, 94197649008, 96503566608, 4615731883344, 4728721980144, 4744863403344, 226171191723408, 231707706601008, 232498637278608, 232611627241008, 11082390700389744, 11353679929526544, 11392435533669744
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 7: 0, 65430653211, 6543206543211, 6654306532101, 654322065443211, 665432065432101, 666543065321001, 65432220654443211, 66543220654432101, 66654320654321001.

Crossrefs

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

A165114 List of fixed points of the base-9 Kaprekar map A165110.

Original entry on oeis.org

0, 41520, 31531872, 326952560, 2598744000, 23087388720, 1901588877840, 16838844110112, 19656251882912, 154312292512560, 1386833627452800, 12276176375647920, 16416600735609280, 112539509113431072
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 9: 0, 62853, 65288533, 753186532, 6632885523, 65528885333, 6653288855323, 65552888853333, 76533188655322, 666332888555223.

Crossrefs

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

A165097 Consider the base-8 Kaprekar map n->K(n) defined in A165090. Sequence gives numbers belonging to cycles of length greater than 1.

Original entry on oeis.org

1022, 1589, 2044, 2212, 2723, 3122, 3178, 3290, 17892, 20475, 21483, 21987, 25578, 26586, 102837, 177443, 217938, 1445787, 1449819, 1646442, 1707930, 1715994, 1740690, 1752786, 1777482, 1941345, 1978137, 1982169, 6589877, 11381027
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Initial terms in base 8: 1776, 3065, 3774, 4244, 5243, 6062, 6152, 6332, 42744, 47773.

Crossrefs

In other bases: Empty (base 2), A165000 (base 3), A165019 (base 4), A165039 (base 5), A165058 (base 6), A165078 (base 7), A165117 (base 9), A099010 (base 10).
Showing 1-10 of 16 results. Next