Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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's say that we have a function $3n^2-3n+13$. How do I know if the function only yields prime number without exhausting all the possibilities by trial and error?

share|cite|improve this question
It doesn't. Think of a clever choice of $n$ that kills primality. – André Nicolas Dec 7 '12 at 6:26
No (non-constant) polynomial with integer coefficients yields prime numbers for all integer arguments. – mjqxxxx Dec 7 '12 at 7:04

If your function is $f(n)=3n^{2}-3n+13$ by putting $n=13$ you will have $f(n)=13(39-3+1)$ that is not prime, even without thinking! why you ask it?

share|cite|improve this answer
It is really $13(39-3+1)$ but the message is the same. Generally, for any polynomial you can set $n$ to any factor of the constant term. This takes care of all polynomials except those with a constant term of $\pm 1$ – Ross Millikan Dec 7 '12 at 6:57
@RossMillikan, you are correct. But I wondered as I saw his question when he was accent on without exhausting all the possibilities by trial and error ! But by what you said here I think he will earn better thought and will not be bothered on same case when numbers will be changed. – AmirHosein SadeghiManesh Dec 7 '12 at 7:11
@AmirHoseinSadeghiManesh: Like your approach. +1 – Babak S. Dec 15 '12 at 14:17

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.