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.

A364458 Prime numbers that are not repdigits with digits in nondecreasing order with the property that any nontrivial permutation of the digits gives a composite number.

Original entry on oeis.org

19, 23, 29, 47, 59, 67, 89, 223, 227, 229, 233, 257, 269, 449, 499, 557, 599, 677, 1447, 2267, 2447, 4447, 5557, 8999, 11119, 15559, 22229, 22669, 23333, 24889, 44449, 48889, 55589, 55889, 59999, 79999, 222269, 444449, 455557, 555557, 555589, 666667, 4444469, 4555559
Offset: 1

Views

Author

Jean-Marc Rebert, Dec 23 2023

Keywords

Comments

The least terms with respectively 2, 3, 4 distinct digits are 19, 257, 24889.

Examples

			19 is a term, because the digits of 19 are in nondecreasing order and 91 is the unique number != 19 given by a permutation of 19 and 91 = 7 * 13 is composite and the digits of 91 are not in nondecreasing order.
		

Crossrefs

Programs

  • PARI
    is(k)=my(u=digits(k),n=#u);if(#vecsort(u,,8)==1||u!=vecsort(u)||!isprime(k),return(0));forperm(n,p,my(vp=Vec(p),v=[]);for(i=1,n,v=concat(v,u[vp[i]]));q=fromdigits(v);if(k!=q&&isprime(q),return(0)));1
    
  • PARI
    \\ See PARI link
    
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations as mp
    from itertools import count, islice, combinations_with_replacement as mc
    def bgen(d): yield from ("".join(m) for m in mc("123456789", d))
    def agen(): yield from (t for d in count(1) for k in bgen(d) if len(set(k))!=1 and isprime(t:=int(k)) if not any((j:="".join(m))!=k and isprime(int(j)) for m in mp(k)))
    print(list(islice(agen(), 44))) # Michael S. Branicky, Dec 23 2023