OFFSET
1,3
EXAMPLE
For n=3: The permutations of {1, 2, 3} are {{1}, {2}, {3}, {1, 2}, {1, 3}, {2, 1}, {2, 3}, {3, 1}, {3, 2}, {1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}, the concatenations are {1, 2, 3, 12, 13, 21, 23, 31, 32, 123, 132, 213, 231, 312, 321}, and the primes are {2, 3, 13, 23, 31}, so a(3) = 5.
MATHEMATICA
pp[n_] := Module[{m, lst = {}}, For[m = 1, m <= n, m++, AppendTo[lst, Length[Select[ToExpression@StringJoin@IntegerString@# & /@ Permutations[Range[m], All], PrimeQ[#] &]]]; ]; lst ]; pp[10] (* J. Stauduhar, Apr 28 2013*)
PROG
(Python)
from sympy import isprime
from itertools import permutations
def a(n): return sum(1 for r in range(1, n+1) for p in permutations(range(1, n+1), r) if isprime(int("".join(map(str, p)))))
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Jan 20 2022
CROSSREFS
KEYWORD
nonn,base,more,hard
AUTHOR
J. Stauduhar, Apr 27 2013
EXTENSIONS
a(11)-a(12) from Michael S. Branicky, Jan 20 2022
a(13) from Michael S. Branicky, Jan 22 2022
STATUS
approved