%I #17 Feb 18 2024 05:42:22
%S 1,2,13,103,107,1007,1013,1049,1079,1237,10013,10039,10079,10139,
%T 10237,10279,10379,13789,100127,100139,100235,100237,100279,101237,
%U 101239,102347,102367,102379,103579,103789,1001234,1001237,1001239,1002347,1002359,1002367,1002379
%N Values of n where number of permutations of digits a(n) that are prime increases.
%H Michael S. Branicky, <a href="/A046891/b046891.txt">Table of n, a(n) for n = 1..91</a>
%t ap[n_] := Count[FromDigits /@ Permutations[IntegerDigits[n]], _?PrimeQ]; t = {1}; x = 0; Do[If[ap[i] > x, AppendTo[t, i]; x = ap[i]], {i, 105000}]; t (* _Jayanta Basu_, Jun 29 2013 *)
%o (Python)
%o from sympy import prime
%o from gmpy2 import is_prime
%o from sympy.utilities.iterables import multiset_permutations as mp
%o from itertools import count, islice, combinations_with_replacement as mc
%o def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p))))
%o def bgen(d):
%o for f in "123456789":
%o yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1)))
%o def agen():
%o record = -1
%o for d in count(1):
%o for k in bgen(d):
%o v = f(k)
%o if v > record:
%o record = v
%o yield k
%o print(list(islice(agen(), 30))) # _Michael S. Branicky_, Feb 17 2024
%Y Cf. A039999, A046892.
%K nonn,base
%O 1,2
%A _David W. Wilson_
%E a(35) and beyond from _Michael S. Branicky_, Feb 17 2024