login
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.
1
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,1
COMMENTS
The least terms with respectively 2, 3, 4 distinct digits are 19, 257, 24889.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..108 (all terms with <= 52 digits)
David A. Corneth, PARI program
EXAMPLE
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.
PROG
(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
CROSSREFS
Sequence in context: A305835 A019384 A088987 * A217281 A322960 A348935
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Dec 23 2023
STATUS
approved