combinations - Finding (2n C n) mod (1000000006) -
i trying solve problem on spoj - http://www.spoj.com/problems/powpow/ have reduced stage have find (a ^ (exp % (m-1))) % m,(m = 1000000007) using fermat's little theorem. face big problem find exp % m. can not use inverse modulo here find 1/(n!) mod (m-1) since gcd(n!, m-1) != 1. have researched lot on google , programming websites this. thing have found use chinese remainder theorem solve these equations: n = 1 mod 2 n = exp mod 500000003 , n exp % (m-1) not able understand how can reach these equations? there other way solve this?
Comments
Post a Comment