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.

Previous Showing 11-20 of 29 results. Next

A165072 A165071(n)/6.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 5, 4, 3, 2, 1, 0, 1, 6, 5, 4, 3, 2, 1, 0, 8, 8, 16, 24, 32, 40, 48, 8, 0, 8, 16, 24, 32, 40, 16, 8, 8, 16, 24, 32, 40, 24, 16, 16, 16, 24, 32, 40, 32, 24, 24, 24, 24, 32, 40, 40, 32, 32, 32, 32
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165071.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165033 (base 5), A165052 (base 6), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A165086 Consider the base-7 Kaprekar map x->K(x) described in A165071. Sequence gives the smallest number that belongs to a cycle of length n under repeated iteration of this map, or -1 if there is no cycle of length n.

Original entry on oeis.org

0, 144, 1068, 9458722410775248, 9936, 55500, 65945195409025452
Offset: 1

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Comments

Known values (to 100 base-7 digits):
a(1) = 0 (base 10) = 0 (base 7)
a(2) = 144 (base 10) = 264 (base 7)
a(3) = 1068 (base 10) = 3054 (base 7)
a(4) = 9458722410775248 (base 10) = 5544222066654442212 (base 7)
a(5) = 9936 (base 10) = 40653 (base 7)
a(6) = 55500 (base 10) = 320544 (base 7)
a(7) = 65945195409025452 (base 10) = 55332221066554443312 (base 7)
a(9) = 419850417612 (base 10) = 42222166444443 (base 7)
a(10) = 114965566537586468276798389479111631100827277423731225926928273344 (base 10) = 65444444444444444444444443066666666666666666666666532222222222222222222222211 (base 7)
a(11) = 31412208 (base 10) = 530666532 (base 7)
a(12) = 26884299308652 (base 10) = 5443216666443222 (base 7)
a(13) = 894060461610805641013834968 (base 10) = 54444444322106666665544322222222 (base 7)
a(14) = 1591271424672409468790707489057394638817384701224062547077367141620193382944 (base 10) = 65444444444444444444444444444306666666666666666666666666665322222222222222222222222222211 (base 7)
a(17) = 107837050564847832079804652808012 (base 10) = 55444444332221110666655554443322222212 (base 7)
a(24) = 7598644111289477155212 (base 10) = 54443222221066554444432222 (base 7)
a(25) = 18244344524504743400068812 (base 10) = 544432222222106655444444432222 (base 7)

Crossrefs

In other bases: A153881 (base 2), A165008 (base 3), A165028 (base 4), A165047 (base 5), A165067 (base 6), A165106 (base 8), A165126 (base 9), A151959 (base 10).

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

Original entry on oeis.org

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, 18, 9, 0, 9, 18, 72, 63, 54, 45, 36, 27, 18, 9, 0, 9, 81, 72, 63, 54, 45, 36, 27, 18, 9, 0, 99, 99, 198, 297, 396, 495, 594, 693, 792, 891, 99, 0, 99, 198, 297, 396, 495, 594, 693, 792
Offset: 0

Views

Author

N. J. A. Sloane, Aug 18 2009

Keywords

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

Examples

			For n = 15, a(15) = 51 - 15 = 36. - _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. also A004185, A004186, A099009 (fixed points).

Programs

  • Haskell
    a151949 n = a004186 n - a004185 n
    -- Reinhard Zumkeller, corrected: Mar 23 2015, Jul 09 2013
    
  • 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 *)
  • PARI
    a(n) = {my(d=digits(n)); fromdigits(vecsort(d,,4)) - fromdigits(vecsort(d));} \\ Michel Marcus, Dec 08 2019
  • Python
    def A151949(n):
        return int("".join(sorted(str(n),reverse=True)))-int("".join(sorted(str(n)))) # Indranil Ghosh, Feb 01 2017
    

Extensions

More terms from Robert G. Wilson v, Aug 19 2009
More than the usual number of terms are shown in order to distinguish this from similar sequences. - N. J. A. Sloane, Sep 22 2021

A165012 a(n) = image of n under the base-4 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 0, 3, 0, 3, 6, 6, 3, 0, 3, 9, 6, 3, 0, 15, 15, 30, 45, 15, 0, 15, 30, 30, 15, 15, 30, 45, 30, 30, 30, 30, 30, 30, 45, 30, 15, 15, 30, 30, 15, 0, 15, 45, 30, 15, 15, 45, 45, 45, 45, 45, 30, 30, 30, 45, 30, 15, 15, 45, 30, 15, 0, 63, 75, 138, 201, 75, 63, 126, 189, 138, 126
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 11, 11_10 = 23_4. So, a(11) = 32_4 - 23_4 = 14 - 11 = 3. - _Indranil Ghosh_, Feb 02 2017
		

Crossrefs

Cf. A165013.
In other bases: A164884 (base 2), A164993 (base 3), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10).

Programs

  • Mathematica
    b4km[n_]:=Module[{idn4=Sort[IntegerDigits[n,4]]},FromDigits[ Reverse[ idn4],4]-FromDigits[idn4,4]]; Array[b4km,80,0]
  • PARI
    cons(m) = {local(b, r); r=0; b=1; for(i=1, matsize(m)[2], r=r+b*m[i]; b=b*4); r}
    A165012(n) = {local(m, r); r=[]; m=n; while(m>0, r=concat(m%4, r); m=floor(m/4)); cons(vecsort(r,,0))-cons(vecsort(r,,4))} \\ Michael B. Porter, Nov 05 2009

A165051 a(n) = image of n under the base-6 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 5, 0, 5, 10, 15, 20, 10, 5, 0, 5, 10, 15, 15, 10, 5, 0, 5, 10, 20, 15, 10, 5, 0, 5, 25, 20, 15, 10, 5, 0, 35, 35, 70, 105, 140, 175, 35, 0, 35, 70, 105, 140, 70, 35, 35, 70, 105, 140, 105, 70, 70, 70, 105, 140, 140, 105, 105, 105, 105, 140, 175, 140, 140, 140
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 10, 10_10 = 14_6. So, a(10) = 41_6 - 14_6 = 25 - 10 = 15. - _Indranil Ghosh_, Feb 02 2017
		

Crossrefs

Cf. A165052.
In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10).

Programs

  • Mathematica
    a[n_] := With[{dd = IntegerDigits[n, 6]}, FromDigits[ReverseSort[dd], 6] - FromDigits[Sort[dd], 6]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)

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

Original entry on oeis.org

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
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 11, 11_10 = 13_8. So, a(11) = 31_8 - 13_8 = 25 - 11 = 14. - _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).

Programs

  • 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 *)
  • 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

A165110 a(n) = image of n under the base-9 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 16, 24, 32, 40, 48, 56, 16, 8, 0, 8, 16, 24, 32, 40, 48, 24, 16, 8, 0, 8, 16, 24, 32, 40, 32, 24, 16, 8, 0, 8, 16, 24, 32, 40, 32, 24, 16, 8, 0, 8, 16, 24, 48, 40, 32, 24, 16, 8, 0, 8, 16, 56, 48, 40, 32, 24, 16, 8, 0, 8, 64, 56, 48, 40, 32, 24, 16, 8
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 11, 11_10 = 12_9. So, a(11) = 21_9 - 12_9 = 19 - 11 = 8. - _Indranil Ghosh_, Feb 02 2017
		

Crossrefs

Cf. A165111.
In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A151949 (base 10).

Programs

  • Mathematica
    a[n_] := With[{dd = IntegerDigits[n, 9]}, FromDigits[ReverseSort[dd], 9] - FromDigits[Sort[dd], 9]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)

A165032 a(n) = image of n under the base-5 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 0, 0, 4, 0, 4, 8, 12, 8, 4, 0, 4, 8, 12, 8, 4, 0, 4, 16, 12, 8, 4, 0, 24, 24, 48, 72, 96, 24, 0, 24, 48, 72, 48, 24, 24, 48, 72, 72, 48, 48, 48, 72, 96, 72, 72, 72, 72, 48, 48, 48, 72, 96, 48, 24, 24, 48, 72, 48, 24, 0, 24, 48, 72, 48, 24, 24, 48, 96, 72, 48, 48, 48, 72, 72, 72
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 10, 10_10 = 20_5. So, a(10) = 20_5 - 2_5 = 10 - 2 = 8. - _Indranil Ghosh_, Feb 02 2017
		

Crossrefs

Cf. A165033.
In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10).

Programs

  • Mathematica
    a[n_] := With[{dd = IntegerDigits[n, 5]}, FromDigits[ReverseSort[dd], 5] - FromDigits[Sort[dd], 5]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)

A164993 a(n) = image of n under the base-3 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 2, 0, 2, 4, 2, 0, 8, 8, 16, 8, 0, 8, 16, 8, 8, 16, 16, 16, 16, 8, 8, 16, 8, 0, 26, 32, 58, 32, 26, 52, 58, 52, 58, 32, 26, 52, 26, 0, 26, 52, 26, 32, 58, 52, 58, 52, 26, 32, 58, 32, 26, 52, 58, 64, 58, 52, 58, 64, 58, 52, 58, 52, 58, 52, 26, 32, 58, 32, 26, 64, 58, 52, 58, 32
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Examples

			For n = 10, 10_10 = 101_3. So, a(10) = 110_3 - 11_3 = 12 - 4 = 8. - _Indranil Ghosh_, Feb 02 2017
		

Crossrefs

Cf. A164994.
In other bases: A164884 (base 2), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10).

Programs

  • Mathematica
    a[n_] := With[{dd = IntegerDigits[n, 3]}, FromDigits[ReverseSort[dd], 3] - FromDigits[Sort[dd], 3]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)

A164884 a(n) = image of n under the base-2 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 1, 0, 3, 3, 3, 0, 7, 9, 9, 7, 9, 7, 7, 0, 15, 21, 21, 21, 21, 21, 21, 15, 21, 21, 21, 15, 21, 15, 15, 0, 31, 45, 45, 49, 45, 49, 49, 45, 45, 49, 49, 45, 49, 45, 45, 31, 45, 49, 49, 45, 49, 45, 45, 31, 49, 45, 45, 31, 45, 31, 31, 0, 63, 93, 93, 105, 93, 105, 105, 105, 93, 105, 105
Offset: 0

Views

Author

Joseph Myers, Aug 29 2009

Keywords

Examples

			For n = 17, 17_10 = 10001_2. So, a(17) = 11000_2 - 11_2 = 24 - 3 = 21. - _Indranil Ghosh_, Feb 01 2017
		

Crossrefs

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

Programs

  • Mathematica
    a[n_] := With[{dd = IntegerDigits[n, 2]}, FromDigits[ReverseSort[dd], 2] - FromDigits[Sort[dd], 2]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jan 08 2020 *)
  • Python
    def A164884(n):
        return int("".join(sorted(bin(n)[2:],reverse=True)),2)-int("".join(sorted(bin(n)[2:])),2) # Indranil Ghosh, Feb 01 2017

Extensions

Cross-references edited by Joseph Myers, Sep 04 2009
Previous Showing 11-20 of 29 results. Next