login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A224716 Number of primes contained in the concatenations of the length-1 to length-n partial permutations of {1,..., n}. 0
0, 1, 5, 14, 36, 119, 1336, 5056, 43089, 519812, 3368023, 30019238, 645814311 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
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
Sequence in context: A048745 A307462 A292170 * A127980 A054486 A072130
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 01:06 EDT 2024. Contains 371964 sequences. (Running on oeis4.)