login
Number of ways to group the first 2*n natural numbers into n pairs (xi, yi) such that the n numbers xi + yi are all different.
3

%I #37 Jan 14 2024 12:11:00

%S 1,1,2,10,55,412,3736,40518,505486,7145031,112844566,1970286922,

%T 37676184205

%N Number of ways to group the first 2*n natural numbers into n pairs (xi, yi) such that the n numbers xi + yi are all different.

%H Altug Alkan, <a href="/A320129/a320129.png">Line plot of t(n)-t(n-1) where t(n) = a(n+1)/a(n) for n <= 11</a>

%F a(n) >= A272363(n).

%e For n = 2, a(2) = 2 since {(1,3), (2,4)} and {(1,2), (3,4)} are corresponding sets. {(2,4), (1,3)} and {(3,1), (4,2)} are considered to be the same grouping with {(1,3), (2,4)}.

%o (PARI)

%o okperm(vp, n) = {for (k=1, n-1, if (vp[k] > vp[k+1], return (0)); ); for (k=1, n, if (vp[k+n] <= vp[k], return (0)); ); 1; }

%o a(n) = if(n==0, 1, {nb = 0; nn = 2*n; for (j=0, nn!-1, vp = numtoperm(nn, j); if (okperm(vp, n), vs = vector(n, k, vp[k]+vp[k+n]); if (#vs == #Set(concat(vs)), nb++); ); ); nb; } ) \\ after _Michel Marcus_ at A272363

%o (Python)

%o from sympy.utilities.iterables import multiset_partitions

%o def A320129(n):

%o return 1 if n == 0 else sum(1 for p in multiset_partitions(list(range(1,2*n+1)),n) if max(len(d) for d in p) == 2 and len(set(sum(d) for d in p)) == n) # _Chai Wah Wu_, Oct 08 2018

%Y Cf. A002968, A060963, A272363.

%K nonn,more

%O 0,3

%A _Altug Alkan_, Oct 06 2018

%E a(11)-a(12) from _Giovanni Resta_, Oct 09 2018