login
Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 2.
2

%I #16 Dec 13 2019 13:25:35

%S 2,6,18,50,140,392,1106,3138,8952,25652,73788,212940,616226,1787606,

%T 5196626,15134930,44152808,128996852,377379368,1105350728,3241135526,

%U 9513228122,27948336380,82176836300,241813226150,712070156202,2098240353906,6186675630818

%N Number of arrangements of n indistinguishable balls in n boxes with the maximum number of balls in any box equal to 2.

%H Alois P. Heinz, <a href="/A180282/b180282.txt">Table of n, a(n) for n = 2..1665</a> (terms n=2..59 from R. H. Hardin)

%F a(n) = Sum_{j=1..n} binomial(n,j)*binomial(n-j,j) = 2*A097861(n).

%F a(n) = A002426(n) - 1. - _Jeppe Stig Nielsen_, Dec 13 2019

%p b:= proc(n, i, k) option remember; `if`(n=0, 1,

%p `if`(i=0, 0, add(b(n-j, i-1, k), j=0..min(n, k))))

%p end:

%p a:= n-> (k-> b(n$2, k)-b(n$2, k-1))(2):

%p seq(a(n), n=2..30); # _Alois P. Heinz_, Aug 17 2018

%o (PARI) for(n=2,29,print1(sum(j=1,n, binomial(n,j)*binomial(n-j,j)),", ")) \\ _Hugo Pfoertner_, Dec 13 2019

%Y Column 2 of A180281.

%Y Cf. A097861, A002426.

%K nonn

%O 2,1

%A _R. H. Hardin_, Aug 24 2010