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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342139 Number of partitions of [2n] into pairs whose sums or differences are primes. 2

%I #16 Aug 25 2021 05:27:57

%S 1,1,3,8,28,167,810,4664,38344,207255,2059900,19385131,174417011,

%T 1922011637,21058799803,208257199434,2905150193223,38462668421772,

%U 481607876817202,7526871509864950

%N Number of partitions of [2n] into pairs whose sums or differences are primes.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Partition_of_a_set">Partition of a set</a>

%e a(2) = 3: {{1,4}, {2,3}}, {{1,3}, {2,4}}, {{1,2}, {3,4}}.

%p b:= proc(s) option remember; `if`(s={}, 1, (j-> add(`if`(i<j and

%p ormap(isprime, [j+i, j-i]), b(s minus {i, j}), 0), i=s))(max(s)))

%p end:

%p a:= n-> b({$1..2*n}):

%p seq(a(n), n=0..15);

%t b[s_] := b[s] = If[s == {}, 1, With[{j = Max[s]}, Sum[If[i < j && AnyTrue[{j+i, j-i}, PrimeQ], b[s ~Complement~ {i, j}], 0], {i, s}]]];

%t a[n_] := b[Range[2n]];

%t a /@ Range[0, 15] (* _Jean-François Alcover_, Aug 25 2021, after _Alois P. Heinz_ *)

%Y Cf. A000341, A009692, A342136, A342155.

%K nonn,more

%O 0,3

%A _Alois P. Heinz_, Mar 01 2021

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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 2 01:26 EDT 2024. Contains 375600 sequences. (Running on oeis4.)