For a given integer k does there always exist a quadratic polynomial P and integer n such that P(n), P(n+1), …, P(n+k-1) are prime?
Assistant
Are you asking whether for every integer k there exists a quadratic polynomial P(x) with coefficients and an integer n such that the k consecutive values P(n), P(n+1), ..., P(n+k-1) are all prime? Or are you looking for a specific example of such a polynomial and sequence for a given k?
User
Yes I am asking the first thing
Assistant
This is a deep question in number theory related to prime-producing polynomials. I will investigate whether, for every positive integer k, there always exists a quadratic polynomial P(x) and an integer n such that P(n), P(n+1), ..., P(n+k-1) are all prime.
I will explore results from prime-generating polynomials, heuristic arguments, and potential counterexamples to determine whether this statement is universally true or false. I will let you know what I find.
Prime-Generating Quadratic Polynomials
Euler’s Famous Polynomial:A well-known example of a prime-generating quadratic is Euler’s polynomialP(x)=x2+x+41.P(x) = x^2 + x + 41.P(x)=x2+x+41.Euler observed that P(n) is prime for n=0,1,2,…,39 –fortyconsecutive integer inputsmathoverflow.net. (In fact, P(40)=402+40+41=412 is composite, so the streak ends at 40 terms.) This remarkable run of primes is closely related to the algebraic fact that x2+x+41 factors in the ring of integers of Q(−163), a class number one field. Other quadratic polynomials with smaller constants show similar “prime runs”: for example, 41yieldsprimesforx=1upto40aswellmathoverflow.net,andx^2 - x + 17isprimeforx=1upto16.Theseareoftenexplainedbyclass−number−1phenomenainquadrati41isthelargestknownconstantthatachievx^2\pm x + C$ formsmathoverflow.net.
Beyond Euler’s 40 Primes:Euler’s polynomial was long believed to be exceptional, but later examples showed even longer prime stretches are possible with other quadratics. For instance, the polynomial
P(x)=n2−79n+1601,P(x) = ,
which is essentially a “reversed” version of Euler’s (obtained by the change x↦39−x), produces primes for n=0,1,2,…,79mathworld.wolfram.com. This yields80 consecutive prime outputs, though here the set of prime values repeats – it is really the same 40 prime values from Euler’s , taken forward and then backward (the polynomial is symmetric, giving , , etc.)mathworld.wolfram.com. If we count only distinct primes, it still gives 40 unique primes as before. However, by tailoring coefficients one can do even better: computational searches have found quadratics with longer runs ofdistinctprimes. Notably, an example discovered by J. Ruby (1989) is a transformed polynomial whose absolute values primes in a rowfor arguments from –33 to 11oeis.org. In other words, there exists an integer-coefficient quadratic such that is prime (in the positive sense) for 45 consecutive integer -values. This 45-term streak is one of the longest known for any quadratic polynomial. Several other quadratic polynomials achieving prime runs in the 30s and 40s (in length) are documented in the literaturemathworld.wolfram.commathworld.wolfram.com, showing that these prime-rich patterns are not unique to Euler’s example.
Empirical Pattern:These examples suggest that as the constant term (and other coefficients) grow, a quadratic might attain a longer initial prime sequence. There is a clear reason why a runcannotexceed the polynomial’s constant term indefinitely: if a polynomial P(x) has coefficients and P(0)=C, then for x=C one finds , so is divisible by math.stackexchange.com. Unless (a very special case), will be a composite number. In Euler’s case , and indeed was the first composite encountered. This is a general number-theoretic obstruction:no non-constant polynomial with integer coefficients can output only primes(an 18th-century result of , later noted by and proved using basic congruencesmathworld.wolfram.com). Thus every such polynomial must fail at some point; the question is how long it can produce primes before that first failure. So far, “scores” of up to 45 consecutive primes have been achieved for quadratics, but no known polynomial yields, say, 100 primes in a row – finding such would require extremely large coefficients and becomes computationally daunting as grows.
Heuristics and Number-Theoretic Constraints
Prime Density and Heuristic Limitations:The longer the string of consecutive prime outputs, the larger the values the polynomial is generating, and thus the rarer it is (heuristically) for all of them to be prime. Roughly speaking, for “random” large numbers the probability of k specific numbers all being prime is about \prod_{i=0}^{k-1}\frac{1}{\ln <REDACTED> (where N_iarethevaluesinquestion).kP(n)O(n^2)P(n),P(n+1),\dots,P(n+k-1)n^2k(\text{const})/(\ln n)^{,k}nkP(x)nn=01nP(n),P(n+1),\dots,P(n+k-1)kn$. There is no knowntheoreticalcut-off, however – it’s all a matter of probability and clever polynomial design.
Divisibility Obstructions:Another fundamental limitation comes from modular arithmetic. For a given quadratic P(x), consider a prime p thatcandivide some value of P(x). If, for example, P(r) for some integer , then any run of prime values cannot include an that makes one of these outputs equal to modulo , or else that term would be divisible by (and hence composite)en.wikipedia.org. In particular, if a prime is small relative to , the consecutive arguments cover all residues mod (if ), so by the pigeonhole principle one of those willhitthe “bad” congruence that makes divisible by . This means that to have primes in a row, the polynomial must avoid any modulus for which has a root mod . In Euler’s case (), the polynomial has no roots modulo small primes like – a fact tied to the special algebraic nature of 41. But generally, a random quadratic will have some small prime factors appearing in its values. To achieve a long prime run, must be carefully tuned so that for every small prime up to (at least) the length , either forany or the specific sequence of values avoids those troublesome residues. This is a strong constraint as grows. In practice, polynomials that set records have large constant terms (to postpone the inevitable divisibility failure) and often are constructed so that misses many small primes. For example, the 45-prime polynomial mentioned above was a “transformed” quadratic chosen to sidestep small- factors up to a certain boundoeis.org. These divisibility considerations illustrate why finding ever-longer prime sequences requires increasingly delicate control of modulo many primes.
Conjectures on Arbitrarily Long Prime Runs
Bunyakovsky’s and –Littlewood’s Conjectures:Even though no polynomial can be prime forallx, number theorists believe that many polynomials produce infinitely many primes scattered along the integers. ’s conjecture (1857) asserts that any irreducible polynomial with integer coefficients and no fixed prime factor should take on prime values infinitely often. For example, it predicts infinitely many primes of the form n2+1, n2, etc. – none of which is proven. In the specific case of quadratic polynomials, Hardy and Littlewood in 1923 developed aprime-density conjecture(the-tuple conjecturespecialized to polynomials) that gives an asymptotic formula for how often a given quadratic yields primesen.wikipedia.orgen.wikipedia.org. They famously conjectured, for instance, that is prime infinitely often (sometimes calledHardy–Littlewood’s Conjecture F). These conjectures imply there isno finite limitto how long a prime run a polynomialcouldachieve – as one allows larger coefficients, one should find longer stretches of primes. In particular, for any fixed , it is believed there exists some quadratic and some integer such that are all prime. There’s no known reason (aside from computation) that, say, 100 primes in a row from a quadratic is impossible – it’s expected to occursomewhere, just perhaps at astronomically large or for very large coefficients.
–Horn Conjecture:The strongest heuristic framework for this problem is theBateman–Horn conjecture(1962)en.wikipedia.orgen.wikipedia.org. It generalizes Hardy–Littlewood and , giving a formula for the density of n such that asystemof polynomials are all prime. In our context, consider the k polynomials obtained by shifting a quadratic:f__0(x)=P(x),; f__1(x)=P(x+1),; \dots,; f_{,k-1}(x)=P(x+k-1).We seek n making all fi(n) prime. –Horn states that if this polynomialsystemhas no unavoidable prime divisor (in other words, there is no prime that divides the product for every integer ) – this condition is a generalization of Bunyakovsky’s criterion to multiple polynomialsen.wikipedia.org– then there should be infinitely many that give simultaneously prime values. Moreover, it predicts the asymptotic frequency of such . This conjectureimpliesthat for every positive integer , one can find a quadratic polynomial and infinitely many such that are all prime. In other words, arbitrarily long “prime runs” from quadraticsshouldexist. They would be extremely rare for large (the conjectural density falls off like a constant times Nkkk=2P(x)=x^2+1k=1$ just recovers ’s single-polynomial conjecture).
Current Status – No Proof Yet:Despite these convincing heuristics,no one has proventhat such prime-producing polynomials exist for every k. In fact, even the base case of ’s conjecture for a single irreducible quadratic (like n2+1) remains unproved – we do not know a single quadratic that produces infinitely many primes. Likewise, proving that a given polynomial pair P(x),P is simultaneously prime for infinitely many would be as difficult as the twin prime conjecture in a nonlinear setting (and is open). The Green–Tao theorem, which shows there are arbitrarily long arithmetic progressions of primes, deals with linear polynomials () and uses methods very different from what’s needed for nonlinear polynomials. For quadratics, we are far from a proof of infinitely many length- prime patterns except for small in trivial ways.
Conclusion:All evidence and prevailing conjectures suggest that for every positive integer k, one can find a quadratic polynomial P(x) that generates k primes in a row (and indeed infinitely many such runs over the natural numbers). There are no known theoretical obstructions stopping longer and longer prime sequences aside from the need to avoid obvious divisibility pitfalls. However, without a breakthrough in number theory (resolving conjectures like –Horn or prime k-tuple distributions), this remains unproved. In practice, mathematicians have found specific quadratics producing prime runs up to length ~, and it is expected that with larger search bounds (and perhaps allowing huge coefficients) one could find even longer runs. But the general statement –arbitrarily long consecutive primes from some quadratic– is an open problem firmly in the realm of conjecture.
References:
Euler’s prime-generating polynomial and its 40-prime streakmathoverflow.netmath.stackexchange.com.
Longer prime sequences from quadratic polynomials (empirical results up to 45 primes)oeis.orgmathworld.wolfram.com.
Discussions of prime-yielding polynomials and necessary conditions (Bunyakovsky’s criterion)en.wikipedia.org.
–Horn conjecture on prime values of polynomial systemsen.wikipedia.orgen.wikipedia.org.
Euler’s prime-generating polynomial and its 40-prime streakmathoverflow.netmath.stackexchange.com.
Longer prime sequences from quadratic polynomials (empirical results up to 45 primes)oeis.orgmathworld.wolfram.com.
Discussions of prime-yielding polynomials and necessary conditions (Bunyakovsky’s criterion)en.wikipedia.org.
–Horn conjecture on prime values of polynomial systemsen.
Cite this conversation
“For a given integer k does there always exist a quadratic polynomial P and integer n….” Conversation with ChatGPT (version unspecified), from the ShareChat — Chatbot Conversations in the Wild dataset. The Chat Archive, 2026. https://thechatarchive.com/c/01m84vx43e6ptwp2y39hy472qs