Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let $f(x)$ be a cubic polynomial (not necessarily irreducible over $\mathbb{Z}[x]$). Fix a prime $p$. Are there any ways to tell when $f(n) \equiv 0 \pmod{p}$ has 3, 2, 1, or 0 solutions?

share|cite|improve this question
An obvious idea that comes to mid is trying all $p$ possible values. Is $p$ assumed to be so large that this would be impractical? – Marc van Leeuwen Mar 21 '13 at 12:55
up vote 3 down vote accepted

$\mathbb{F}_p$ is a field, so most stuff that works for reals works here too. You can look for Cardano's formula, but you end up taking roots. To see if there are repeat roots, compute $\gcd(p'(x), p(x))$ (the formal derivative is computed as for the reals, and as there any common factors between $p(x)$ and $p'(x)$ are for roots of multiplicity greater than 1). There are algorithms for factoring polynomials, symbolic mathematics packages like PARI/GP or SAGE probably include them.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.