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 A360986 #27 Mar 06 2023 02:59:40 %S A360986 2,3,5,7,199,919,991,2999,9929,11177,11717,17117,31333,33331,71171, %T A360986 71711,161611,616111,999499,1111333,1131133,1131331,1133131,1313311, %U A360986 3111313,3111331,3131113,3131311,3133111,3311131,3337777,3377377,3773377,3773773,7377373,7733377,7737337,7737733,32333333 %N A360986 Primes whose sum of decimal digits has the same set of decimal digits as the prime. %H A360986 Robert Israel, <a href="/A360986/b360986.txt">Table of n, a(n) for n = 1..10000</a> %e A360986 a(5) = 199 is a term because 199 is prime and 1+9+9 = 19 has the same set {1,9} of decimal digits as 199. %p A360986 dmax:= 7: # for terms with up to dmax digits %p A360986 dsets:= proc(s, S) option remember; %p A360986 # nondecreasing lists [x_1, ..., x_n] with sum s and set of elements S %p A360986 local i, x1; %p A360986 if S = {} then if s = 0 then return {[]} else return {} fi fi; %p A360986 x1:= min(S); %p A360986 `union`(seq(map(t -> [x1$i, op(t)], procname(s-i*x1, S minus {x1})), i=1..`if`(x1=0,dmax,floor(s/x1)))) %p A360986 end proc: %p A360986 R:= {2,3,5,7}: count:= 4: %p A360986 for s from 2 to 9*dmax-1 do %p A360986 if s mod 3 = 0 then next fi; %p A360986 ds:= convert(convert(s,base,10),set); %p A360986 DS:= select (t -> nops(t) > 1 and nops(t) <= dmax, dsets(s,ds)); %p A360986 for r in DS do %p A360986 for v in remove(t -> member(t[1],[0,2,4,5,6,8]) or t[-1]=0,combinat:-permute(r)) do %p A360986 p:= add(v[i]*10^(i-1),i=1..nops(v)); %p A360986 if isprime(p) then R:= R union {p}; count:= count+1; %p A360986 fi %p A360986 od od od: %p A360986 sort(convert(R,list)); %o A360986 (PARI) isok(p) = if (isprime(p), my(d=digits(p)); Set(d) == Set(digits(vecsum(d)))); \\ _Michel Marcus_, Feb 28 2023 %Y A360986 Cf. A000040, A158473. %Y A360986 Primes in A249515. %K A360986 nonn,base %O A360986 1,1 %A A360986 _Robert Israel_, Feb 27 2023