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 A358020 #22 Oct 25 2022 20:05:21 %S A358020 1111111111111111111,31,71,191,223,229,113,73,4111,433,4447,353,599, %T A358020 661,677,1117,337,97,383,8999,797,10111,1013,701,1009,131,271,311,173, %U A358020 193,419,1151,571,613,617,317,197,811,199,1193,719,911,2111,233,277,929,2333,293,421,521,2557 %N A358020 Least prime number > prime(n) (n >= 5) whose set of decimal digits coincides with the set of decimal digits of prime(n), or -1 if no such prime exists. %H A358020 Jean-Marc Rebert, <a href="/A358020/b358020.txt">Table of n, a(n) for n = 5..10000</a> %e A358020 prime(6) = 13 and the prime number 31 have the same set of digits {1,3}, and 31 is the smallest such number, hence a(6) = 31. %e A358020 prime(13) = 41 and the prime number 4111 have the same set of digits {1,4}, and 4111 is the smallest such number, hence a(13) = 4111. %e A358020 prime(20) = 71 and the prime number 1117 have the same set of digits {1,7}, and 1117 is the smallest such number, hence a(20) = 1117. %p A358020 N:= 60: # for a(5)..a(N) %p A358020 A:= Array(5..N): %p A358020 R:= 1111111111111111111: %p A358020 A[5]:= R: count:= 1: %p A358020 for k from 6 while count < N-4 do %p A358020 p:= ithprime(k); %p A358020 S:= convert(convert(p,base,10),set); %p A358020 if assigned(V[S]) and V[S]<=N then A[V[S]]:= p; count:=count+1; fi; %p A358020 V[S]:= k; %p A358020 od: %p A358020 convert(A,list); # _Robert Israel_, Oct 25 2022 %o A358020 (PARI) a(n)=my(m=Set(digits(prime(n)))); if(n<5, return()); if(n==5,return(1111111111111111111));forprime(p=prime(n+1), , if(Set(digits(p))==m, return(p))) %o A358020 (Python) %o A358020 from sympy import isprime, prime %o A358020 from itertools import count, product %o A358020 def a(n): %o A358020 pn = prime(n) %o A358020 s = str(pn) %o A358020 for d in count(len(s)): %o A358020 for p in product(set(s), repeat=d): %o A358020 if p[0] == "0": continue %o A358020 t = int("".join(p)) %o A358020 if t > pn and isprime(t): %o A358020 return t %o A358020 print([a(n) for n in range(5, 56)]) # _Michael S. Branicky_, Oct 25 2022 %Y A358020 Cf. A000040, A357096, A004022, A004023, A020451, A020455, A050288, A166681. %K A358020 nonn,base %O A358020 5,1 %A A358020 _Jean-Marc Rebert_, Oct 24 2022