cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A071058 Number of ways of pairing odd numbers in the range 1 to n with even numbers in the range n+1 to 2n such that each pair sums to a prime.

This page as a plain text file.
%I A071058 #20 Sep 21 2023 14:24:53
%S A071058 1,1,1,1,2,2,4,6,10,7,21,11,40,53,215,181,773,939,3260,4432,23431,
%T A071058 15811,80724,67891,429108,434963,2748239,2718150,21654009,21580655,
%U A071058 107459138,92370364,638616984,564878656,5055810584,4545704064,35787453599,36878092180
%N A071058 Number of ways of pairing odd numbers in the range 1 to n with even numbers in the range n+1 to 2n such that each pair sums to a prime.
%H A071058 Martin Fuller, <a href="/A071058/b071058.txt">Table of n, a(n) for n = 1..70</a>
%F A071058 a(2n) = A071059(2n).
%e A071058 a(5)=2 because there are two ways: 1+10, 3+8, 6+5 and 1+6, 3+10, 5+8.
%t A071058 a[n_] := a[n] = Module[{s1, s2, s3, s4, i, ik, km},
%t A071058 s1 = Select[Flatten[Outer[List, Range[1, n, 2], Range[2n, n+1, -2]], 1],
%t A071058    PrimeQ[Total[#]]&];
%t A071058 s2 = SplitBy[s1, First];
%t A071058 km = Length[s2];
%t A071058 ik = Table[{i[k], 1, Length[s2[[k]]]}, {k, 1, km}];
%t A071058 s3 = Table[Table[s2[[k, i[k]]], {k, 1, km}], Evaluate[Sequence @@ ik]] //
%t A071058    Flatten[#, km-1]&;
%t A071058 s4 = Select[s3, Length[Union[Flatten[#]]] == 2km&];
%t A071058 s4 // Length];
%t A071058 Table[Print[n, " ", a[n]]; a[n], {n, 1, 20}] (* _Jean-François Alcover_, Aug 10 2022 *)
%o A071058 (PARI) a(n)=matpermanent(matrix((n+1)\2,(n+1)\2,i,j,isprime((i+j-2)*2+n+3-(n%2)))); \\ _Martin Fuller_, Sep 21 2023
%Y A071058 The product of this sequence and A071059 gives A070897.
%K A071058 hard,nice,nonn
%O A071058 1,5
%A A071058 _T. D. Noe_, May 25 2002
%E A071058 More terms from _David W. Wilson_, May 27 2002
%E A071058 a(31)-a(36) from _Donovan Johnson_, Aug 12 2010