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

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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

%I #19 Aug 14 2017 02:40:33

%S 0,1,4,7,22,160,938,7261,67492,572848,6774544,71929775,985400749,

%T 12521202682,188765264950,2889019817104,47703971114988,877662524710517

%N 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.

%e 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.

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

%o (PARI) a(n)=sum(k=1,n!,if(isprime(sum(i=1,n,i*component(numtoperm(n,k),i)))-1,0,1))

%o (PARI) a(n)=local(V=vector(n,x,x)~);sum(k=1,n!,isprime(numtoperm(n,k)*V)) \\ _Hagen von Eitzen_, Jun 26 2009

%K more,nonn

%O 1,3

%A _Benoit Cloitre_, Aug 19 2002

%E a(10)-a(11) from _Hagen von Eitzen_, Jun 26 2009

%E a(12)-a(14) from _Donovan Johnson_, Sep 24 2010

%E a(15)-a(18) from _Robert Gerbicz_, Nov 21 2010

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.

Last modified August 6 15:42 EDT 2024. Contains 374974 sequences. (Running on oeis4.)