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 21-30 of 42 results. Next

A319655 Write n in 7-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 1, 8, 9, 10, 11, 12, 13, 2, 9, 16, 17, 18, 19, 20, 3, 10, 17, 24, 25, 26, 27, 4, 11, 18, 25, 32, 33, 34, 5, 12, 19, 26, 33, 40, 41, 6, 13, 20, 27, 34, 41, 48, 1, 8, 9, 10, 11, 12, 13, 8, 57, 58, 59, 60, 61, 62, 9, 58, 65, 66, 67, 68, 69, 10, 59, 66, 73
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), this sequence (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*7^(i-1), i=1..nops(l)))(sort(convert(n, base, 7))):
    seq(a(n), n=0..73);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 7]], 7], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 7)), 7); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(7, 100)
    

A319656 Write n in 8-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 14, 15, 2, 10, 18, 19, 20, 21, 22, 23, 3, 11, 19, 27, 28, 29, 30, 31, 4, 12, 20, 28, 36, 37, 38, 39, 5, 13, 21, 29, 37, 45, 46, 47, 6, 14, 22, 30, 38, 46, 54, 55, 7, 15, 23, 31, 39, 47, 55, 63, 1, 9, 10, 11, 12, 13, 14
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), this sequence (b=8), A319657 (b=9), A004185 (b=10).
Cf. A165090.

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*8^(i-1), i=1..nops(l)))(sort(convert(n, base, 8))):
    seq(a(n), n=0..70);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 8]], 8], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 8)), 8); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(8, 100)
    

A319657 Write n in 9-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 10, 11, 12, 13, 14, 15, 16, 17, 2, 11, 20, 21, 22, 23, 24, 25, 26, 3, 12, 21, 30, 31, 32, 33, 34, 35, 4, 13, 22, 31, 40, 41, 42, 43, 44, 5, 14, 23, 32, 41, 50, 51, 52, 53, 6, 15, 24, 33, 42, 51, 60, 61, 62, 7, 16, 25, 34, 43, 52, 61, 70, 71
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), this sequence (b=9), A004185 (b=10).
Cf. A165110.

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*9^(i-1), i=1..nops(l)))(sort(convert(n, base, 9))):
    seq(a(n), n=0..71);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 9]], 9], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 9)), 9); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(9, 100)
    

A211654 Primes that remain prime when their digits are sorted into nondecreasing order.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 47, 59, 67, 71, 73, 79, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 157, 167, 173, 179, 193, 197, 199, 223, 227, 229, 233, 239, 257, 269, 271, 277, 293, 307, 311, 317, 337, 347, 349, 359, 367, 373
Offset: 1

Views

Author

Francis J. McDonnell, Apr 17 2012

Keywords

Comments

In sequence A004185 these are referred to as "sortable primes". Nontrivial terms (with digits not in nondecreasing order) are listed in A086042. - M. F. Hasler, Jul 30 2019.

Examples

			173 is prime and after the digits are sorted into nondecreasing order we obtain 137, which is prime.
		

Crossrefs

Cf. A086042 (nontrivial solutions), A004185 (n with digits sorted).

Programs

  • Magma
    [p:p in PrimesUpTo(400)| IsPrime(Seqint(Reverse(Sort(Intseq(p,10)))))]; // Marius A. Burtea, Jul 30 2019
  • Mathematica
    Select[Prime[Range[200]], PrimeQ[FromDigits[Sort[IntegerDigits[#]]]] &] (* T. D. Noe, Apr 17 2012 *)
  • PARI
    select( is_A211654(p)={isprime(fromdigits(vecsort(digits(p))))&&isprime(p)}, primes([1,999])) \\ M. F. Hasler, Jul 30 2019
    

A028905 Arrange digits of primes in ascending order.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 13, 37, 14, 34, 47, 35, 59, 16, 67, 17, 37, 79, 38, 89, 79, 11, 13, 17, 19, 113, 127, 113, 137, 139, 149, 115, 157, 136, 167, 137, 179, 118, 119, 139, 179, 199, 112, 223, 227, 229, 233, 239, 124, 125, 257, 236, 269
Offset: 1

Views

Author

Keywords

Comments

Leading zeros are discarded (e.g., 107, rearranged to 017, becomes 17).

Examples

			The digits of 41 are 4, 1, which sorted are 1, 4; those are reinterpreted as 14.
The digits of 43 are 4, 3, which sorted are 3, 4; those are reinterpreted as 34.
The digits of 47 are 4, 7, which are already sorted, so 47 is not changed.
		

Crossrefs

Programs

  • Haskell
    a028905 = a004185 . a000040  -- Reinhard Zumkeller, Apr 03 2015
    
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[Prime[n]]]], {n, 100}] (* Alonso del Arte, Nov 25 2019 *)
  • PARI
    eva(n) = subst(Pol(n), x, 10)
    a(n) = eva(vecsort(digits(prime(n)))) \\ Felix Fröhlich, Nov 25 2019

Formula

a(n) = A004185(A000040(n)). - Reinhard Zumkeller, Apr 03 2015
a(n) = prime(n) if prime(n) is in A028864. - Alonso del Arte, Nov 25 2019

Extensions

More terms from Patrick De Geest, Apr 1998
Offset corrected by Reinhard Zumkeller, Apr 03 2015

A065641 Smallest number with persistence n for the sort-and-subtract-sequence.

Original entry on oeis.org

0, 1, 10, 60, 90, 101, 120, 380, 450, 505, 807, 1020, 1070, 1303, 1450, 3810, 10020, 10404, 10560, 16056, 16200, 18088, 20322, 20580, 35790, 79000, 80088, 90877, 243700, 279509, 330832, 374330, 380038, 903655, 1002404, 1005064, 1020828
Offset: 0

Views

Author

Ulrich Schimke (ulrschimke(AT)aol.com), Dec 03 2001

Keywords

Comments

Sort the digits of an integer and subtract the result from the original. Continue with the result until you reach 0. The sequence gives the least integer that needs n steps to reach 0.

Examples

			60 is the smallest number that needs 3 steps to reach 0: 60 -> 60 - 06 = 54 -> 54 - 45 = 9 -> 9 - 9 = 0, hence a(3) = 60.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a065641 n = a065641_list !! (n-1)
    a065641_list = map (fromJust . (`elemIndex` a193582_list)) [1..]
    -- Reinhard Zumkeller,Aug 10 2011
  • Mathematica
    Persist[n_] := Length[NestWhileList[# - FromDigits[Sort[IntegerDigits[#]]] &, n, # != 0 &]] - 1; nn = 20; t = Table[0, {nn}]; cnt = 0; k = 0; While[cnt < nn, k++; c = Persist[k]; If[c <= nn && t[[c]] == 0, t[[c]] = k; cnt++]]; t  (* Harvey P. Dale, Mar 24 2011 *)
    persist[n_]:=Length[NestWhileList[#-FromDigits[Sort[IntegerDigits[#]]]&,n,#!=0&]]-1; Module[ {nn=103*10^4,tbl},tbl=Table[{n,persist[n]},{n,0,nn}];DeleteDuplicates[ tbl,GreaterEqual[ #1[[2]],#2[[2]]]&]][[;;,1]] (* Harvey P. Dale, Sep 03 2023 *)

Extensions

Added a(0) = 0. David W. Wilson, Jan 08 2017

A193582 Persistence of n for sort-and-subtract (A193581).

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 3, 2, 2, 2
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 10 2011

Keywords

Comments

Number of sort-and-subtract steps to reach 0 when starting with n.

Crossrefs

Cf. A004185.

Programs

  • Haskell
    a193582 n = length $ takeWhile (> 0) $ iterate a193581 n
    a193582_list = map a193582 [0..]

A221714 Numbers written in base 2 with digits rearranged to be in decreasing order.

Original entry on oeis.org

0, 1, 10, 11, 100, 110, 110, 111, 1000, 1100, 1100, 1110, 1100, 1110, 1110, 1111, 10000, 11000, 11000, 11100, 11000, 11100, 11100, 11110, 11000, 11100, 11100, 11110, 11100, 11110, 11110, 11111, 100000, 110000, 110000, 111000, 110000
Offset: 0

Views

Author

Bruce L. Rothschild and N. J. A. Sloane, Jan 26 2013

Keywords

Comments

This is the base-2 equivalent of A004186.

Crossrefs

For decimal equivalents see A073138.

Programs

  • Maple
    a:= n-> parse(cat(0, sort(Bits[Split](n), `>`)[])):
    seq(a(n), n=0..36);  # Alois P. Heinz, Aug 18 2025
  • Mathematica
    a[n_] := FromDigits[-Sort[-IntegerDigits[n, 2]]] (* Giovanni Resta, Jan 27 2013 *)
  • Python
    def a(n):
         return "".join(sorted(bin(n)[2:],reverse=True)) # Indranil Ghosh, Jan 09 2017
    
  • Python
    def A221714(n): return int(bin((m:=1<>n.bit_count()))[2:]) # Chai Wah Wu, Aug 18 2025

Extensions

a(18)-a(36) from Giovanni Resta, Jan 27 2013

A237568 Fibonacci-like sequence of numbers with nondecreasing positive digits. Let a^+ denote the number that is obtained from a if its positive digits are written in nondecreasing order, while zeros remain in their places. Let a<+>b = (a + b)^+. a(0)=0, a(1)=1, for n>=2, a(n) = a(n-1) <+> a(n-2).

Original entry on oeis.org

0, 1, 1, 2, 3, 5, 8, 13, 12, 25, 37, 26, 36, 26, 26, 25, 15, 40, 55, 59, 114, 137, 125, 226, 135, 136, 127, 236, 336, 257, 359, 166, 255, 124, 379, 305, 468, 377, 458, 358, 168, 256, 244, 500, 447, 479, 269, 478, 477, 559, 1036, 1559, 2559, 1148, 3707, 4558, 2568, 1267, 3358, 2456, 1458, 1349, 2708, 4057, 5667, 2479, 1468, 3479, 4479, 5789, 10268, 15067, 23355, 22348
Offset: 0

Views

Author

Vladimir Shevelev, Feb 09 2014

Keywords

Comments

Note that operation n^+ differs from the one in A004185. If a term of the sequence has k digits, then it is followed by terms with >=k digits. The sequence has 7 terms with 1 digit, 13 terms with 2 digits, 30 terms with 3 digits, etc. The corresponding maximal terms are 8, 59, 559, etc.
The sequence is eventually periodic with period of length 144 and the first position of period 237. - Peter J. C. Moses, Feb 09 2014

Crossrefs

Programs

  • Mathematica
    a[0]:=0;a[1]:=1;a[n_]:=a[n]=FromDigits[Insert[DeleteCases[Sort[#],0],0,1+#-Range[Length[#]]&[Position[#,0]]]&[IntegerDigits[a[n-1]+a[n-2]]]]; Map[a,Range[0,99]] (* Peter J. C. Moses, Feb 09 2014 *)

A237575 Fibonacci-like numbers with nonincreasing positive digits. Let a** denote the number that is obtained from a if its digits are written in nonincreasing order. Let a<+>b = (a + b)**. a(0)=0, a(1)=1, for n>=2, a(n) = a(n-1) <+> a(n-2).

Original entry on oeis.org

0, 1, 1, 2, 3, 5, 8, 31, 93, 421, 541, 962, 5310, 7622, 93221, 843100, 963321, 8642110, 9654310, 98642210, 986522100, 8654311100, 9864332000, 88654311100, 98865431100, 987754221100, 9866652211000, 86544432110000, 98644321110000, 888755322110000
Offset: 0

Views

Author

Vladimir Shevelev, Feb 09 2014

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, n, parse(cat(
          sort(convert(a(n-1)+a(n-2), base, 10), `>`)[])))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Aug 31 2022
  • Mathematica
    a[0]:=0;a[1]:=1;a[n_]:=a[n]=FromDigits[Reverse[Sort[IntegerDigits[a[n-1]+a[n-2]]]]];Map[a,Range[0,20]] (* Peter J. C. Moses, Feb 09 2014 *)

Extensions

Correction and extension by Peter J. C. Moses
Previous Showing 21-30 of 42 results. Next