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
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