### lin7xu's blog

By lin7xu, history, 13 days ago, How to calculate the coefficient of $\prod\limits_{i=0}^{p-1}(x+i) \bmod p$ ($p$ is a prime)? Thank you for reply. Comments (8)
 » It is also the first kind of Stirling number.
 » 13 days ago, # | ← Rev. 2 →   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-1hence, Out of the above, exactly one term will be divisible by phence, 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...
 » which coefficient r u interested in?
 » In fact the answer is very beautiful, but sadly no one mentioned it.. It equals to $x^p-x$. I don't know why, can anyone explain it?
•  » » From Fermat's theory we know that $x^p \equiv x\pmod p$ holds for every integer. So when modulo $p$, $F(x)=x^p-x$ must be a multiple of $x,x+1,…,x+(p-1)$ at the same time. Pay attention to the fact that $F$ is of degree $p$, and the given equation is proved.
 » Now, I'm not a math genius or anything.However, I do know that when multiplying a list of X consecutive numbers, the result is always divisible by X. Therefore, the answer to your question is 0, because the result is always divisible by P, even if P is a prime.
•  » » I want to calculate the coefficient for every $x^i$, and the answer is $x^p-x$, that there is only two nonempty positions.
•  » » » Oh, I thought you wanted the mod, sorry.