login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #24 Sep 21 2023 14:16:38

%S 1,1,1,1,1,2,2,6,4,7,6,11,11,53,53,181,171,939,925,4432,4545,15811,

%T 15583,67891,68193,434963,388975,2718150,3113343,21580655,18425145,

%U 92370364,94887088,564878656,572364768,4545704064,4092294083,36878092180,36363930614

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

%H Martin Fuller, <a href="/A071059/b071059.txt">Table of n, a(n) for n = 1..70</a>

%F a(2n) = A071058(2n).

%e a(6)=2 because there are two ways: 2+9, 4+7, 6+11 and 2+11, 4+9, 6+7.

%p f:= proc(n) local m;

%p m:= floor(n/2);

%p LinearAlgebra:-Permanent(Matrix(m,m,

%p (i,j) -> `if`(isprime((i+j-2)*2 + n + 3 + (n mod 2)),1,0)))

%p end proc:

%p f(1):= 1:

%p map(f, [$1..40]); # _Robert Israel_, Sep 21 2023

%t a[n_] := a[n] = If[n == 1, 1, Module[{s1, s2, s3, s4, i, ik, km},

%t s1 = Select[Flatten[Outer[List, Range[2, n, 2], Range[2n-1, n+1, -2]], 1], PrimeQ[Total[#]]&];

%t s2 = SplitBy[s1, First];

%t km = Length[s2];

%t ik = Table[{i[k], 1, Length[s2[[k]]]}, {k, 1, km}];

%t s3 = Table[Table[s2[[k, i[k]]], {k, 1, km}], Evaluate[Sequence @@ ik]] // Flatten[#, km - 1]&;

%t s4 = Select[s3, Length[Union[Flatten[#]]] == 2km&];

%t s4 // Length]];

%t Table[Print[n, " ", a[n]]; a[n], {n, 1, 20}] (* _Jean-François Alcover_, Aug 10 2022 *)

%o (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

%Y The product of this sequence and A071058 gives A070897.

%K nice,nonn

%O 1,6

%A _T. D. Noe_, May 25 2002

%E More terms from _David W. Wilson_, May 27 2002

%E a(31)-a(37) from _Donovan Johnson_, Aug 12 2010