A071059 Number of ways of pairing even numbers in the range 1 to n with odd numbers in the range n+1 to 2n such that each pair sums to a prime.
1, 1, 1, 1, 1, 2, 2, 6, 4, 7, 6, 11, 11, 53, 53, 181, 171, 939, 925, 4432, 4545, 15811, 15583, 67891, 68193, 434963, 388975, 2718150, 3113343, 21580655, 18425145, 92370364, 94887088, 564878656, 572364768, 4545704064, 4092294083, 36878092180, 36363930614
Offset: 1
Examples
a(6)=2 because there are two ways: 2+9, 4+7, 6+11 and 2+11, 4+9, 6+7.
Links
- Martin Fuller, Table of n, a(n) for n = 1..70
Programs
-
Maple
f:= proc(n) local m; m:= floor(n/2); LinearAlgebra:-Permanent(Matrix(m,m, (i,j) -> `if`(isprime((i+j-2)*2 + n + 3 + (n mod 2)),1,0))) end proc: f(1):= 1: map(f, [$1..40]); # Robert Israel, Sep 21 2023
-
Mathematica
a[n_] := a[n] = If[n == 1, 1, Module[{s1, s2, s3, s4, i, ik, km}, s1 = Select[Flatten[Outer[List, Range[2, n, 2], Range[2n-1, n+1, -2]], 1], PrimeQ[Total[#]]&]; s2 = SplitBy[s1, First]; km = Length[s2]; ik = Table[{i[k], 1, Length[s2[[k]]]}, {k, 1, km}]; s3 = Table[Table[s2[[k, i[k]]], {k, 1, km}], Evaluate[Sequence @@ ik]] // Flatten[#, km - 1]&; s4 = Select[s3, Length[Union[Flatten[#]]] == 2km&]; s4 // Length]]; Table[Print[n, " ", a[n]]; a[n], {n, 1, 20}] (* Jean-François Alcover, Aug 10 2022 *)
-
PARI
a(n)=matpermanent(matrix(n\2,n\2,i,j,isprime((i+j-2)*2+n+3+(n%2)))); \\ Martin Fuller, Sep 21 2023
Formula
a(2n) = A071058(2n).
Extensions
More terms from David W. Wilson, May 27 2002
a(31)-a(37) from Donovan Johnson, Aug 12 2010