[go: up one dir, main page]

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!)
A342155 Number of partitions of [2n] into pairs such that either their sum or their absolute difference is a prime (but not both). 2
1, 1, 2, 3, 7, 26, 55, 282, 1520, 2685, 27005, 171474, 768123, 5936728, 43976303, 207493790, 2570789335, 21669733984, 136340261314, 1639978185920 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
EXAMPLE
a(4) = 7:
{{1,8}, {2,7}, {3,5}, {4,6}},
{{1,8}, {2,7}, {3,4}, {5,6}},
{{1,8}, {2,4}, {3,6}, {5,7}},
{{1,8}, {2,3}, {4,6}, {5,7}},
{{1,8}, {2,4}, {3,5}, {6,7}},
{{1,3}, {2,4}, {5,7}, {6,8}},
{{1,2}, {3,4}, {5,7}, {6,8}}.
MAPLE
b:= proc(s) option remember; `if`(s={}, 1, (j-> add(`if`(i<j and
(isprime(j+i) xor isprime(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 && (PrimeQ[j + i] ~Xor~ PrimeQ[j - i]), 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
Sequence in context: A063852 A301519 A274692 * A308114 A092983 A089708
KEYWORD
nonn,more
AUTHOR
Alois P. Heinz, Mar 02 2021
STATUS
approved

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 August 29 21:34 EDT 2024. Contains 375518 sequences. (Running on oeis4.)