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 11 results. Next

A028864 Primes with digits in nondecreasing order.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 113, 127, 137, 139, 149, 157, 167, 179, 199, 223, 227, 229, 233, 239, 257, 269, 277, 337, 347, 349, 359, 367, 379, 389, 449, 457, 467, 479, 499, 557, 569, 577, 599, 677, 1117, 1123, 1129
Offset: 1

Views

Author

Keywords

Comments

Identical digits are acceptable, e.g., 1117 is in the sequence. - Harvey P. Dale, Aug 16 2011

Crossrefs

Programs

  • Magma
    [p:p in PrimesUpTo(1200)| Reverse(Intseq(p)) eq Sort(Intseq(p))]; // Marius A. Burtea, Nov 29 2019
    
  • Mathematica
    daoQ[n_] := Count[Differences[IntegerDigits[n]], ?(# < 0 &)] == 0; Select[Prime[Range[200]], daoQ] (* _Harvey P. Dale, Aug 16 2011 *)
    Select[Prime[Range[200]],Min[Differences[IntegerDigits[#]]]>-1&] (* Harvey P. Dale, Mar 02 2023 *)
  • PARI
    select(n->n=digits(n); n==vecsort(n), primes(500)) \\ Charles R Greathouse IV, Mar 15 2014
    
  • Python
    from itertools import count, islice, combinations_with_replacement
    from sympy import isprime
    def A028864_gen(): # generator of terms
        yield from (2,3,5,7)
        a, b = {'1':0,'2':1,'3':1,'4':2,'5':2,'6':2,'7':2,'8':3,'9':3}, (1,3,7,9)
        for l in count(1):
            for d in combinations_with_replacement('123456789',l):
                k = 10*int(''.join(d))
                for e in b[a[d[-1]]:]:
                    if isprime(m:=k+e):
                        yield m
    A028864_list = list(islice(A028864_gen(),30)) # Chai Wah Wu, Dec 25 2023
  • R
    j=2; y=as.bigz(c()); while(j<1000) {
    x=sort(as.numeric(strsplit(as.character(j),spl="")[[1]]),decr=F)
    if(j==paste(x[x>0],collapse="")) y=c(y,j)
    j=nextprime(j)
    } //  Christian N. K. Anderson, Apr 04 2013
    

Formula

Trivially, a(n) >> exp(n^(1/10)). - Charles R Greathouse IV, Mar 15 2014
prime(n) = A028905(n) if prime(n) is in this sequence. - Alonso del Arte, Nov 25 2019

Extensions

Definition corrected by Omar E. Pol, Mar 22 2012

A052015 Primes with distinct digits in ascending order.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Examples

			Last term is a(100) = 23456789.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) `if`(isprime(n), n, [][]), seq(
          b(parse(cat(n, j))), j=irem(n, 10)+1..9)
        end:
    sort([seq(b(n), n=1..9)])[];  # Alois P. Heinz, Jun 16 2025
  • Mathematica
    t={};Do[p=Prime[n];If[Select[Differences[IntegerDigits[p]],#<=0&]=={},AppendTo[t,p]],{n,380}];t (* Jayanta Basu, May 04 2013 *)
    Select[Prime[Range[5000]],Min[Differences[IntegerDigits[#]]]>0&] (* Harvey P. Dale, Jun 20 2015 *)
    Select[FromDigits@# &/@Subsets@Range@9,PrimeQ] (* Hans Rudolf Widmer, Apr 08 2023 *)
  • PARI
    A052015=vecextract( vecsort( vector( 511,i,isprime( t=eval( concat( vecextract(Vec("123456789"),i ))))*t),NULL,8),"^1") /* for old PARI versions replace,NULL,8),"^1" by ),"-100.." */ \\ M. F. Hasler, Jan 27 2009
    
  • Python
    from sympy import isprime
    from itertools import combinations
    def agen(): # generator of terms
        for d in range(1, 9):
            for c in combinations("123456789", d):
                if isprime(t:=int("".join(c))):
                    yield t
    print(list(agen())) # Michael S. Branicky, Dec 13 2023

A052014 Primes with distinct digits in descending order.

Original entry on oeis.org

2, 3, 5, 7, 31, 41, 43, 53, 61, 71, 73, 83, 97, 421, 431, 521, 541, 631, 641, 643, 653, 743, 751, 761, 821, 853, 863, 941, 953, 971, 983, 5431, 6421, 6521, 7321, 7541, 7621, 7643, 8431, 8521, 8543, 8641, 8731, 8741, 8753, 8761, 9421, 9431, 9521, 9631, 9643
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Comments

Last term is a(87) = 98765431.

Crossrefs

Programs

  • Maple
    b:= proc(n) `if`(isprime(n), n, [][]), seq(
          b(parse(cat(n, j))), j=1..irem(n, 10)-1)
        end:
    sort([seq(b(n), n=1..9)])[];  # Alois P. Heinz, Jun 16 2025
  • Mathematica
    Select[Prime[Range[1200]], Max[DigitCount[#]] == 1 && And@@Negative[ Differences[IntegerDigits[#]]]&] (* Harvey P. Dale, Oct 22 2011 *)
    t={}; Do[p=Prime[n]; If[Select[Differences[IntegerDigits[p]], # >= 0&] == {}, AppendTo[t,p]], {n,1195}]; t (* Jayanta Basu, May 04 2013 *)
  • PARI
    A052014=[]; for( i=1,1023, c=-1; isprime( t=sum( j=0,9, if(bittest(i,j),j*10^c++))) & A052014=concat(A052014,t)); A052014=vecsort(A052014)

A372034 For a positive number k, let L(k) denote the list consisting of k followed by the prime factors of k, with repetition, in nondecreasing order; sequence gives composite k such that the digits of L(k) are in nonincreasing order.

Original entry on oeis.org

4, 8, 9, 22, 32, 33, 44, 55, 64, 77, 88, 93, 99, 422, 633, 775, 844, 933, 993, 4222, 4442, 6333, 6655, 6663, 7533, 7744, 7775, 8444, 8884, 9663, 9993, 44222, 66333, 88444, 99633, 99933, 99993, 933333, 966333, 996663, 999993, 4442222, 6663333, 7777775, 8884444, 9663333, 9666633, 9666663
Offset: 1

Views

Author

Scott R. Shannon, Apr 16 2024

Keywords

Comments

Is it true that no terms end with 1? A separate search on those shows none with < 70 digits. Michael S. Branicky, Apr 23 2024
Testing all products of repunit primes (A004022, A004023), there are no terms ending in 1 less than 10^3000. - Michael S. Branicky, Apr 24 2024

Examples

			The initial terms and their factorizations are:
4 = [2, 2]
8 = [2, 2, 2]
9 = [3, 3]
22 = [2, 11]
32 = [2, 2, 2, 2, 2]
33 = [3, 11]
44 = [2, 2, 11]
55 = [5, 11]
64 = [2, 2, 2, 2, 2, 2]
77 = [7, 11]
88 = [2, 2, 2, 11]
93 = [3, 31]
99 = [3, 3, 11]
422 = [2, 211]
633 = [3, 211]
775 = [5, 5, 31]
844 = [2, 2, 211]
933 = [3, 311]
993 = [3, 331]
4222 = [2, 2111]
4442 = [2, 2221]
6333 = [3, 2111]
6655 = [5, 11, 11, 11]
6663 = [3, 2221]
7533 = [3, 3, 3, 3, 3, 31]
7744 = [2, 2, 2, 2, 2, 2, 11, 11]
...
		

Crossrefs

Programs

  • Python
    from sympy import factorint, isprime
    def ni(s): return sorted(s, reverse=True) == list(s)
    def ok(n):
        if n < 4 or isprime(n): return False
        s, f = str(n), "".join(str(p)*e for p, e in factorint(n).items())
        return ni(s+f)
    print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Apr 23 2024
    
  • Python
    # faster for initial segment of sequence
    from sympy import factorint, isprime
    from itertools import islice, combinations_with_replacement as mc
    def ni(s): return s == "".join(sorted(s, reverse=True))
    def bgen(d):
        yield from ("".join(m) for m in mc("987654321", d))
    def agen(): # generator of terms
        for d in range(1, 70):
            out = set()
            for s in bgen(d):
                t = int(s)
                if t < 4 or isprime(t): continue
                if ni(s+"".join(str(p)*e for p, e in factorint(t).items())):
                    out.add(t)
            yield from sorted(out)
    print(list(islice(agen(), 50))) # Michael S. Branicky, Apr 23 2024

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
    

A190220 Numbers all of whose divisors are numbers whose decimal digits are in nonincreasing order.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 21, 22, 31, 33, 40, 41, 43, 44, 53, 55, 61, 62, 63, 66, 71, 73, 77, 82, 83, 86, 88, 93, 97, 99, 110, 211, 220, 311, 331, 421, 422, 431, 433, 440, 443, 511, 521, 541, 622, 631, 633, 641, 643, 653, 661, 662, 733, 743, 751
Offset: 1

Views

Author

Jaroslav Krizek, May 06 2011

Keywords

Comments

Subset of A009996. Superset of A028867, A190219 and A190217.

Examples

			Number 110 is in sequence because all divisors of 110 (1, 2, 5, 10, 11, 22, 55, 110) are numbers whose decimal digits are in nonincreasing order.
		

Programs

  • Maple
    with(numtheory): A190220 := proc(n) option remember: local d, dd, i, j, k, m, poten: if(n=1)then return 1: fi: for k from procname(n-1)+1 do d:=divisors(k): poten:=1: for i from 1 to nops(d) do m:=-1: dd:=convert(d[i], base, 10): for j from 1 to nops(dd) do if(m<=dd[j])then m:=dd[j]: else poten:=0: break: fi: od: if(poten=0)then break:fi: od: if(poten=1)then return k: fi: od: end: seq(A190220(n), n=1..64); # Nathaniel Johnston, May 14 2011

A211655 Down-sortable primes: Primes that are also primes after digits are sorted into decreasing order.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 41, 43, 53, 61, 71, 73, 79, 83, 97, 113, 131, 149, 157, 163, 167, 179, 181, 191, 197, 199, 211, 241, 251, 281, 311, 313, 331, 337, 347, 359, 373, 389, 419, 421, 431, 433, 443, 461, 463, 491, 521, 541, 563, 571, 593, 613, 617, 631, 641, 643, 653
Offset: 1

Views

Author

Francis J. McDonnell, Apr 17 2012

Keywords

Comments

All 1- and 2-digit reversible primes (A007500) are trivially in this sequence. No primes from A056709 are in this sequence. Clearly all absolute primes (A003459) are sortable primes but not all sortable primes are absolute primes. - Alonso del Arte, Oct 08 2013

Examples

			131 is prime and after sorting its digits into nonincreasing order we obtain 311, which is prime.
163 is in the sequence because its digits sorted in decreasing order give 631, which is prime. (Note that this is not a reversible prime, since 361 = 19^2.)
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[200]], PrimeQ[FromDigits[-Sort[-IntegerDigits[#]]]] &] (* T. D. Noe, Apr 17 2012 *)

A345326 Number of primes less than 10^n with digits in nonincreasing order.

Original entry on oeis.org

0, 4, 14, 49, 125, 296, 646, 1304, 2459, 4543, 7882, 13272, 21856, 34934, 53446, 82055, 121322, 175498, 251714, 354810, 488440, 676065, 914834, 1220629, 1627770, 2135954, 2759889, 3590609, 4602572, 5830588, 7386200, 9266652, 11469407, 14314939, 17658240
Offset: 0

Views

Author

Ilya Gutkovskiy, Jul 22 2021

Keywords

Comments

Number of primes with at most n digits arranged in nonincreasing order.

Crossrefs

Programs

  • Mathematica
    Table[Length@Select[Prime@Range[PrimePi[10^n]],OrderedQ@Reverse@IntegerDigits@#&],{n,0,7}] (* Giorgos Kalogeropoulos, Jul 22 2021 *)
  • Python
    from sympy import isprime
    from itertools import accumulate, combinations_with_replacement as mc
    def numwithdigs(d):
        if d == 0: return 0
        nonincreasing = (int("".join(m)) for m in mc("987654321", d))
        return len(list(filter(isprime, nonincreasing)))
    def aupto(nn): return list(accumulate(numwithdigs(d) for d in range(nn+1)))
    print(aupto(14)) # Michael S. Branicky, Jul 22 2021

Extensions

a(12)-a(34) from Michael S. Branicky, Jul 22 2021

A061245 Prime numbers with odd digits in descending order.

Original entry on oeis.org

3, 5, 7, 11, 31, 53, 71, 73, 97, 311, 331, 733, 751, 773, 911, 953, 971, 977, 991, 997, 3331, 5333, 5531, 7331, 7333, 7753, 9311, 9511, 9533, 9551, 9733, 9931, 9973, 33311, 33331, 55331, 55333, 55511, 73331, 75511, 75533, 75553, 77551, 77711
Offset: 1

Views

Author

Amarnath Murthy, Apr 23 2001

Keywords

Crossrefs

Extensions

More terms from Patrick De Geest, Jun 04 2001

A364831 Primes whose digits are prime and in nonincreasing order.

Original entry on oeis.org

2, 3, 5, 7, 53, 73, 733, 773, 5333, 7333, 7753, 55333, 75533, 75553, 77773, 733333, 755333, 775553, 7553333, 7555333, 7775533, 7777753, 55555333, 55555553, 77755553, 555553333, 755555533, 773333333, 777555553, 777773333, 777775333, 777775553, 777777773
Offset: 1

Views

Author

James C. McMahon, Aug 09 2023

Keywords

Comments

Intersection of A028867 and A019546.
The subsequence for primes whose digits are prime and in strictly decreasing order has just six terms: 2 3 5 7 53 73 (see A177061).

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[3100000]], AllTrue[d = IntegerDigits[#], PrimeQ] && GreaterEqual @@ d &]
  • Python
    from itertools import count, islice, chain, combinations_with_replacement
    from sympy import isprime
    def A364831_gen(): # generator of terms
        yield 2
        yield from chain.from_iterable((sorted(s for d in combinations_with_replacement('753',l) if isprime(s:=int(''.join(d)))) for l in count(1)))
    A364831_list = list(islice(A364831_gen(),30)) # Chai Wah Wu, Sep 10 2023
Showing 1-10 of 11 results. Next