Ask Your Question

Revision history [back]

You can use the prod() function (see prod? for some help):

sage: f = lambda n, k, i : prod([binomial(n+k-l,k) for l in range(1,i+1)])
sage: f(3,4,2)
75

This also works symbolically:

sage: var('n,k')
(n, k)
sage: f(n,k,2)  
binomial(k + n - 2, k)*binomial(k + n - 1, k)