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 A225035 #58 Jan 22 2023 19:51:59 %S A225035 13,17,31,37,71,73,79,97,101,103,107,109,113,127,131,137,139,149,157, %T A225035 163,167,173,179,181,191,193,197,199,239,241,251,271,277,281,283,293, %U A225035 307,311,313,317,331,337,347,349,359,367,373,379,389,397,401,419,421 %N A225035 Primes such that there is a nontrivial rearrangement of the digits which is a prime. %C A225035 The new prime is necessarily different from the original prime (so 11, for example) is not a term. - _N. J. A. Sloane_, Jan 22 2023 %C A225035 Permutations producing leading zeros are allowed: thus 101 is in the sequence because a nontrivial permutation of its digits is 011. - _Robert Israel_, Aug 13 2019 %C A225035 It seems reasonable to expect that the proportion of n-digit primes that are in this sequence approaches 1 as n increases. - _Peter Munn_, Sep 13 2022 %D A225035 H.-E. Richert, On permutation prime numbers, Norsk. Mat. Tidsskr. 33 (1951), p. 50-53. %D A225035 Joe Roberts, Lure of the Integers, Math. Assoc. of Amer., 1992, p. 293. %D A225035 James J. Tattersall, Elementary Number Theory in Nine Chapters, Second Edition, Cambridge University Press, p. 121. %H A225035 Robert Israel, <a href="/A225035/b225035.txt">Table of n, a(n) for n = 1..10000</a> %e A225035 13 is a term since a nontrivial permutation of its digits yields 31, which is also a prime. %p A225035 dmax:=3: # for all terms of up to dmax digits %p A225035 Res:= {}: %p A225035 p:= 1: %p A225035 do %p A225035 p:= nextprime(p); %p A225035 if p > 10^dmax then break fi; %p A225035 L:= sort(convert(p,base,10),`>`); %p A225035 m:= add(L[i]*10^(i-1),i=1..nops(L)); %p A225035 if assigned(A[m]) then %p A225035 if ilog10(A[m])=ilog10(p) then %p A225035 Res:= Res union {A[m], p} %p A225035 else Res:= Res union {p} %p A225035 fi %p A225035 else A[m]:= p %p A225035 fi %p A225035 od: %p A225035 sort(convert(Res,list)); # _Robert Israel_, Aug 13 2019 %t A225035 t={}; Do[p = Prime[n]; list1 = Permutations[IntegerDigits[p]]; If[Length[ Select[Table[FromDigits[n], {n,list1}], PrimeQ]] > 1, AppendTo[t,p]], {n,84}]; t %o A225035 (Python) %o A225035 from sympy import isprime %o A225035 from itertools import permutations %o A225035 def ok(n): %o A225035 if not isprime(n): return False %o A225035 perms = (int("".join(p)) for p in permutations(str(n))) %o A225035 return any(isprime(t) for t in perms if t != n) %o A225035 print([k for k in range(500) if ok(k)]) # _Michael S. Branicky_, Sep 14 2022 %o A225035 (PARI) is(p) = if(isprime(p), my(d=vecsort(digits(p))); d==vector(#d,x,1)&&return(1); forperm(d, e, my(c = fromdigits(Vec(e))); p!=c && isprime(c) && return(1))); \\ _Ruud H.G. van Tol_, Jan 22 2023 %Y A225035 Cf. A052902, A007933, A007935, A166681. %Y A225035 See A055387, A359136-A359139 for other versions. %K A225035 nonn,base %O A225035 1,1 %A A225035 _Jayanta Basu_, Apr 24 2013 %E A225035 Edited by _N. J. A. Sloane_, Jan 22 2023