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.
%I A039986 #100 Feb 17 2024 10:31:11 %S A039986 2,3,5,7,11,19,23,29,41,43,47,53,59,61,67,83,89,151,211,223,227,229, %T A039986 233,257,263,269,353,383,409,431,433,443,449,487,499,523,541,557,599, %U A039986 661,677,773,827,829,853,859,881,883,887,929,997,1447,1451,1481,2111 %N A039986 Primes such that every distinct permutation of digits is composite (including permutations with leading zeros). %C A039986 At most one permutation of digits of A179239 can occur in this sequence. - _David A. Corneth_, Jun 28 2018 %C A039986 Is there a term with more than 4 distinct digits? - _David A. Corneth_, Jun 30 2018 %C A039986 Up through 9999991 (the largest 7-digit prime) there are no terms with more than 4 distinct digits. - _Harvey P. Dale_, Dec 12 2018 %C A039986 The sequence can be seen as a table with the n-digit terms in row n. Row lengths would then be (4, 13, 34, 45, 68, 67, 47, 36, 40, 46, 33, 45, 35, 38, 32, ...). In these rows there are (0, 0, 0, 6, 9, 3, 0, 1, 0, 0, ...) terms with >= 4 distinct digits: this seems to happen only for terms with 4, 5, 6 or 8 digits. I conjecture that there are no more than these 6 + 9 + 3 + 1 = 19 terms (2861, 4027, 4801, 5209, 5623, 5849, 24889, 26561, 40609, 40883, 66541, 66853, 85087, 85843, 86441, 288689, 442469, 558541, 55555429) with 4, and none with 5 or more distinct digits. - _M. F. Hasler_, Jul 01 2018 %C A039986 Prime repunits (A004022) are a subset of this sequence. As larger terms are seemingly all near-repdigit primes, it is possible to obtain very large terms. For example: (10^10002 - 1)/9 - 10^2872. - _Hans Havermann_, Jul 08 2018 %H A039986 Hans Havermann and M. F. Hasler, <a href="/A039986/b039986.txt">Table of n, a(n) for n = 1..1141</a> (Terms < 10^30; earlier terms from T. D. Noe and David A. Corneth.) %H A039986 Hans Havermann, <a href="http://gladhoboexpress.blogspot.com/2018/08/nlic-primes.html">AEnlic primes</a>. %t A039986 t = {}; Do[p=Prime[n]; If[Length[Select[Table[FromDigits[k], {k,Permutations[IntegerDigits[p]]}], PrimeQ]] == 1, AppendTo[t,p]], {n,330}]; t (* _Jayanta Basu_, May 07 2013 *) %t A039986 Select[Prime[Range[400]],AllTrue[FromDigits/@Rest[ Permutations[ IntegerDigits[#]]], CompositeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Nov 22 2015 *) %o A039986 (PARI) is(n,d=digits(n))={isprime(n)&&!for(i=1,(#d)!, (n=vecextract(d,numtoperm(#d,i)))!=d&& isprime(fromdigits(n))&& return)} \\ Then: select(is,primes(500)) - _M. F. Hasler_, Jun 28 2018 %o A039986 is(n)={isprime(n)||return; my(d=vecsort(digits(n), (a, b)->if(a-b&& t=bittest(650, a)-bittest(650, b),t,a-b)), p=vector(#d,i,i), N(p,i=2)= while((t=p[i]-1)&& while((setsearch(Set(p[i+1..#p]),t)|| d[t]==d[p[i]])&& t--,); !t, i++>#p&& return); i<#p|| bittest(650, d[t])|| return; concat([setminus(Set(p[1..i]),[t]), t, p[i+1..#p]]), t); #d==1|| !until(!p=N(p),(n!=t=fromdigits(vecextract(d,p)))&& isprime(t)&& return)} \\ Produces only inequivalent permutations which can be prime. - _M. F. Hasler_, Jun 28 2018 %o A039986 A039986_row(n)={if(n>1, local(D=eval(Vec("0245681379")), u=vectorv(n, i, 10^(n-i)), nextperm()=for(i=2,n,(t=p[i]-1)&& while(setsearch(Set(p[i+1..n]),t)|| d[t]==d[p[i]], t--||break); t|| next; i<n|| bittest(650,d[t])|| return; return(p=concat([setminus(Set(p[1..i]), [t]), t, p[i+1..n]]))), L=List(), f, p, d); forvec(i=vector(n,i,[7^(i==n),10]), vecsum(d=vecextract(D,i))%3|| next; f=0; p=[1..n]; until(!nextperm(), isprime(vecextract(d,p)*u)&& (f&& next(2)|| f=p)); f&& d[f[1]]&& listput(L,vecextract(d,f)*u),1); Set(L), primes(4))} \\ Returns all terms with n digits. - _M. F. Hasler_, Jul 01 2018 %o A039986 (Python) %o A039986 from itertools import count, islice, combinations_with_replacement %o A039986 from sympy.utilities.iterables import multiset_permutations %o A039986 from sympy import isprime %o A039986 def A039986_gen(): # generator of terms %o A039986 for l in count(1): %o A039986 xlist = [] %o A039986 for p in combinations_with_replacement('0123456789',l): %o A039986 flag = False %o A039986 for q in multiset_permutations(p): %o A039986 if isprime(m:=int(''.join(q))): %o A039986 if flag or q[0]=='0': %o A039986 flag = False %o A039986 break %o A039986 else: %o A039986 flag = True %o A039986 r = m %o A039986 if flag: %o A039986 xlist.append(r) %o A039986 yield from sorted(xlist) %o A039986 A039986_list = list(islice(A039986_gen(),30)) # _Chai Wah Wu_, Dec 26 2023 %Y A039986 Cf. A030291, A179239. %Y A039986 Cf. A225421 (only odd digits). %Y A039986 Cf. A244529 for another variant. - _M. F. Hasler_, Jun 28 2018 %K A039986 base,nonn %O A039986 1,1 %A A039986 _David W. Wilson_ %E A039986 Name clarified upon the suggestion of _Robert Israel_, Jun 30 2018