login
A073114
Number of permutations p from (1,2,3,...,n) to (1,2,3,...,n) such that 1*p(1) + 2*p(2) + 3*p(3) + ... + n*p(n) is prime.
0
0, 1, 4, 7, 22, 160, 938, 7261, 67492, 572848, 6774544, 71929775, 985400749, 12521202682, 188765264950, 2889019817104, 47703971114988, 877662524710517
OFFSET
1,3
EXAMPLE
For n=3: permutations (1,3,2) (3,1,2) (2,3,1) (2,1,3) meet the requirement since 1*1 + 2*3 + 3*2 = 13, 1*3 + 2*1 + 3*2 = 11, 1*2 + 2*3 + 3*1 = 11 and 1*2 + 2*1 + 3*3 = 13, hence a(3)=4.
MAPLE
n := 9: with(combinat): P := permute(n): ct := 0: for i to factorial(n) do if isprime(add(j*P[i][j], j = 1 .. n)) = true then ct := ct+1 else end if end do: ct; # yields only the term a(n) corresponding to the n specified at the start of the program # Emeric Deutsch, Jul 22 2009
PROG
(PARI) a(n)=sum(k=1, n!, if(isprime(sum(i=1, n, i*component(numtoperm(n, k), i)))-1, 0, 1))
(PARI) a(n)=local(V=vector(n, x, x)~); sum(k=1, n!, isprime(numtoperm(n, k)*V)) \\ Hagen von Eitzen, Jun 26 2009
CROSSREFS
Sequence in context: A128533 A162559 A126094 * A083830 A363650 A086968
KEYWORD
more,nonn
AUTHOR
Benoit Cloitre, Aug 19 2002
EXTENSIONS
a(10)-a(11) from Hagen von Eitzen, Jun 26 2009
a(12)-a(14) from Donovan Johnson, Sep 24 2010
a(15)-a(18) from Robert Gerbicz, Nov 21 2010
STATUS
approved