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 A166681 #21 Jan 18 2023 15:58:05 %S A166681 13,17,37,79,107,113,127,131,137,139,149,157,163,167,173,179,181,191, %T A166681 197,199,239,241,251,277,281,283,313,337,347,349,359,367,373,379,389, %U A166681 397,419,457,461,463,467,479,491,563,569,571,577,587,593,613 %N A166681 Primes p which have at least one prime anagram larger than p. %C A166681 Primes like 113, 137, 149, 157 etc have more than one such larger anagram, but are only listed once. %H A166681 R. J. Mathar, <a href="/A166681/b166681.txt">Table of n, a(n) for n = 1..1000</a> %e A166681 13 is the first with 31 as prime anagram. %e A166681 17 is the second with 71 as prime anagram. %e A166681 31 has one anagram 13 but this is not >31 so 31 is not in the sequence. %p A166681 filter:= proc(p) local L,Lp,q,i; %p A166681 if not isprime(p) then return false fi; %p A166681 L:= convert(p,base,10); %p A166681 for Lp in combinat:-permute(L) do %p A166681 q:= add(Lp[i]*10^(i-1),i=1..nops(L)); %p A166681 if q > p and isprime(q) then return true fi %p A166681 od; %p A166681 false %p A166681 end proc: %p A166681 select(filter, [seq(i,i=13..1000,2)]); # _Robert Israel_, Jan 18 2023 %t A166681 paQ[n_]:=Length[Select[FromDigits/@Permutations[IntegerDigits[n]],#>n && PrimeQ[#]&]]>0; Select[Prime[Range[200]],paQ] (* _Harvey P. Dale_, Sep 23 2013 *) %o A166681 (Python) %o A166681 from itertools import islice %o A166681 from sympy.utilities.iterables import multiset_permutations %o A166681 from sympy import isprime, nextprime %o A166681 def A166681_gen(): # generator of terms %o A166681 p = 13 %o A166681 while True: %o A166681 for q in multiset_permutations(str(p)): %o A166681 if (r:=int(''.join(q)))>p and isprime(r): %o A166681 yield p %o A166681 break %o A166681 p = nextprime(p) %o A166681 A166681_list = list(islice(A166681_gen(),20)) # _Chai Wah Wu_, Jan 17 2023 %Y A166681 Cf. A055387, A109308, A069567. %K A166681 nonn,base %O A166681 1,1 %A A166681 _Pierre CAMI_, Oct 18 2009 %E A166681 Definition clarified, sequence extended. - _R. J. Mathar_, Oct 12 2012