OFFSET
1,3
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..91
MATHEMATICA
a = {}; b = -1; Do[c = Count[ PrimeQ[ FromDigits /@ Permutations[IntegerDigits[n]]], True]; If[c > b, b = c; a = Append[a, c]], {n, 1, 10^8}]; a
PROG
(Python)
from sympy import prime
from gmpy2 import is_prime
from sympy.utilities.iterables import multiset_permutations as mp
from itertools import count, islice, combinations_with_replacement as mc
def f(n): return sum(1 for p in mp(str(n)) if is_prime(t:=int("".join(p))))
def bgen(d):
for f in "123456789":
yield from map(int, (f+"".join(m) for m in mc("0123456789", d-1)))
def agen():
record = -1
for d in count(1):
for k in bgen(d):
v = f(k)
if v > record:
record = v
yield v
print(list(islice(agen(), 30))) # Michael S. Branicky, Feb 17 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved
