Thursday, 26 February 2015

LUCAS THEOREM !

For nCk;
  nCk % p = ((a1Cb1)*(a2Cb2)*..............*(anCbn)) % p
where a1,a2,a3..... are digits in base-p representation of n &
where b1,b2,b3..... are digits in base-p representation of k. 

For nCr ;

No. of terms divisible in the nCk by a prime no. p may be equal to the :
        (a1+1)*(a2+1)*(a3+1).............. (am+1)   
where a1,a2,a3,...am are the digits in base p representaion (a1a2....am)base p 

Special case of this is the Odd numbers in nCk (i.e row of pascal triangle)


Link to problems:
1) http://www.spoj.com/problems/DUKKAR/
2) http://www.spoj.com/problems/HLP_RAMS/
3) http://www.spoj.com/problems/AJOB/

No comments:

Post a Comment