I have a math problem
source link: http://codeforces.com/blog/entry/104162
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
I have a math problem
6 hours ago, # | It is also the first kind of Stirling number. |
x * (x+1) * (x+2) * (x+3) * (x+4) * ... * (x + (p-1))
any number when divided by p, leaves remainder 0, or 1, ..., or p-1
hence, Out of the above, exactly one term will be divisible by p
hence, the remainder will be 0 (ZERO) or
x * (x+1) * (x+2) * (x+3) * (x+4) * ... * (x + (p-1)) mod p = 0
----------------------THE END BUT-------------------------------
if you want coefficient of
x * (x+1) * (x+2) * (x+3) * (x+4) * ... * (x + (p-1)) divided by p,
then please follow below:
thanks :)
if x%p == 0
then k = 0;
else
then k = p * ((x/p) + 1) - x;
iteration=0
while(iteration <= p-1)
if(iteration != k)
product = product * (x + iteration)
** product is your answer **
hope this helps...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK