Is there a nice cozy formula that will always spit out primes? Try this one: f(n) = n^{2} + n + 41.

Euler discovered that this formula has a long string of prime values: it is prime for all n between 0 and 39 inclusive. However, it is not prime for all integers. In fact, it can be shown that no non-constant polynomial with integral coefficients will always spit out primes at the natural numbers.

There are formulas which *always* spit out primes when you plug in a natural number… here’s one (Mills, 1947): greatest integer less than (X raised to 3^{n}),

where X is approximately 1.3064… Surprised? See the remark below!

**The Math Behind the Fact:**

It is worth pointing out that while the formula above looks nice, it is useless… it grows too quickly, and to determine X is tantamount to knowing the primes in its range!

**How to Cite this Page:**

Su, Francis E., et al. “Formula for Primes?.” *Math Fun Facts*. <https://www.math.hmc.edu/funfacts>.

**References:**

P. Ribenboim, The Little Book of Big Primes

**Fun Fact suggested by: **

Francis Su