OFFSET
0,3
LINKS
Wikipedia, Partition of a set
EXAMPLE
a(2) = 3: {{1,4}, {2,3}}, {{1,3}, {2,4}}, {{1,2}, {3,4}}.
MAPLE
b:= proc(s) option remember; `if`(s={}, 1, (j-> add(`if`(i<j and
ormap(isprime, [j+i, j-i]), b(s minus {i, j}), 0), i=s))(max(s)))
end:
a:= n-> b({$1..2*n}):
seq(a(n), n=0..15);
MATHEMATICA
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}]]];
a[n_] := b[Range[2n]];
a /@ Range[0, 15] (* Jean-François Alcover, Aug 25 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Alois P. Heinz, Mar 01 2021
STATUS
approved