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 A318295 #31 Sep 25 2024 18:03:25 %S A318295 103,107,113,131,137,149,157,163,167,173,179,197,199,307,311,317,337, %T A318295 359,373,379,389,397,419,491,571,593,613,617,631,701,709,719,733,739, %U A318295 751,761,839,907,919,937,941,953,971,983,991,1009,1013,1019,1021,1031,1033 %N A318295 Prime numbers whose digits can be permuted in multiple ways to yield primes. %C A318295 From _Robert Israel_, Sep 06 2018: (Start) %C A318295 "Multiple ways" here means more than one nontrivial permutation other than the identity permutation, i.e., there are at least 3 different primes formed by permuting digits of this prime. %C A318295 Leading 0's are allowed in the permutations. (End) %H A318295 Robert Israel, <a href="/A318295/b318295.txt">Table of n, a(n) for n = 1..10000</a> %e A318295 131 belongs to this sequence as there are two nontrivial permutations of its digits which yield other primes, namely 113 and 311. %e A318295 137 also belongs to this sequence. Even though 371, 713 and 731 are composite, 173 and 317 are prime, satisfying the requirement. %e A318295 139 does not belong in this sequence. Although 193 is prime, 319, 391, 913 and 931 are all composite. %p A318295 filter:= proc(n) local L,Lp,t,i,m,x; %p A318295 if not isprime(n) then return false fi; %p A318295 L:= convert(n,base,10); %p A318295 m:= nops(L); %p A318295 Lp:= combinat:-permute(L); %p A318295 t:= 1; %p A318295 for i from 1 to nops(Lp) do %p A318295 if Lp[i]=L then next fi; %p A318295 x:= add(Lp[i][j]*10^(j-1),j=1..m); %p A318295 if isprime(x) then %p A318295 t:= t+1; %p A318295 if t = 3 then return true fi; %p A318295 fi %p A318295 od; %p A318295 false %p A318295 end proc: %p A318295 select(filter, [seq(i,i=11..2000,2)]); # _Robert Israel_, Sep 06 2018 %t A318295 Select[Prime[Range[200]], Count[PrimeQ[Map[FromDigits, Permutations[IntegerDigits[#]]]], True] > 2 &] (* _Alonso del Arte_, Aug 24 2018 *) %t A318295 Select[Prime[Range[200]],Count[FromDigits/@Rest[Permutations[IntegerDigits[#]]],_?PrimeQ]>1&] (* _Harvey P. Dale_, Sep 25 2024 *) %o A318295 (Python) %o A318295 from itertools import * %o A318295 nmax=1000 %o A318295 def is_prime(num): %o A318295 if num == 0 or num == 1: return(0) %o A318295 for k in range(2, num): %o A318295 if (num % k) == 0: %o A318295 return(0) %o A318295 return(1) %o A318295 ris = "" %o A318295 for i in range(nmax): %o A318295 f=0 %o A318295 lf=[] %o A318295 if is_prime(i): %o A318295 for p in permutations(str(i), len(str(i))): %o A318295 k=int(''.join(p)) %o A318295 if k!=i and is_prime(k): %o A318295 if k not in lf: %o A318295 f+=1 %o A318295 lf.append(k) %o A318295 if f>1: %o A318295 ris = ris+str(i)+"," %o A318295 break %o A318295 print(ris) %Y A318295 Subsequence of A055387. %K A318295 nonn,base %O A318295 1,1 %A A318295 _Pierandrea Formusa_, Aug 23 2018 %E A318295 More terms from _Giovanni Resta_, Sep 03 2018