2
$\begingroup$

I am trying to calculate $\binom{n}{r}$ modulo $1000000007$. I have read here about Lucas' Theorem but it seems to work for small values of $p$. Here $p = 1000000007$. Is there a way this can be solved? Thank you.

  • 0
    I take it by the use of "%" that you mean $\bmod \;p$?2012-12-03
  • 0
    Yes, I mean modulo p.2012-12-03
  • 2
    Since I see 1000000007 here I think this is programming contest problem. You'd better look at this http://stackoverflow.com/questions/10118137/fast-n-choose-k-mod-p-for-large-n2012-12-03
  • 0
    Yes, this is from a contest. I have the idea how to solve the problem, but this comes in the way to solve it.2012-12-03

1 Answers 1