title: How can we compute N choose K modulus a prime number without overflow?
body: <p>How can we computer (<a href="http://en.wikipedia.org/wiki/Binomial_coefficient" rel="nofollow">N choose K</a>)% M in C or C++ without invoking overflow ? </p>
  
  <p>For the particular case when <strong>N (4&lt;=N&lt;=1000)</strong> and <strong>K (1&lt;=K&lt;=N)</strong> and <strong>M = 1000003</strong>.</p>