Re: [algogeeks] Re: Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-27 Thread Dave
@Ankit: I haven't written code for this problem, but here is how I would do it. You are given values of n and P, with n being up to a 500-digit number (e.g., stored in an array, with say 9 digits of the number stored in each of up to 112 (500/9 rounded up) integers and P fitting in one integer.

Re: [algogeeks] Re: Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-27 Thread Ankit Singh
@dave: Can u Please elaborate your idea?? I didn't understand lucas theorem and in that theorem, i see too much calculation and here we have to deal with testcases upto 100 and each testcase containing n in range of 10500. On Mon, Aug 27, 2012 at 4:02 AM, Dave wrote: > @Ankit: Apply Lucas' The

[algogeeks] Re: Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-26 Thread Dave
@Ankit: Apply Lucas' Theorem, which you can find written up in Wikipedia. Dave On Sunday, August 26, 2012 3:57:18 PM UTC-5, Ankit Singh wrote: > In mathematics, *binomial coefficients* are a family of positive integers > that occur as coefficients in the binomial theorem. [image: \tbinom > nk