Question: How to efficiently write a formula in Maple

Let M and K be given positive integers.

I struggle with how to write efficiently this formula in Maple,mainly because it sums over *pairs* of integers K1 and K2, with the given property that "K1+2*K2=K":

0<=K1<=K,

0<=K2<=K/2

 

sum { M!/(M-K1-K2)! * K!/(K1! * K2)! * 1/M^K * 1/2^K2 : such that K1 + 2*K2 = K}

The "!" means factorial.

Please Wait...