Consider a puzzle shared by @sphere_homotopy on X: write down the sequence . The first two terms are and , so their gcd is . Is every pair of neighbors coprime? In other words, is it true that
You could test every positive integer with at most 51 digits and never see the pattern break. To find the first failure, turn the question around: what prime could possibly divide both terms? Once we know the prime, a linear congruence will tell us where to look.
Which prime could divide both terms?
Subtract the first term from the second. This leaves the gcd unchanged and gives us two polynomials of different degrees:
If a prime divides both terms at , then . To eliminate , we use the resultant . The useful fact about is that it is a fixed integer with an identity
Put . Any common divisor of and must divide the right-hand side, so it must divide . Instead of checking infinitely many pairs of neighbors, we need the prime factors of just one integer.
Computing that integer by long division
Work over the rationals and make each polynomial monic, meaning its leading coefficient is . Start with and
Divide by . The quotient is : the cancels the degree-17 term and the cancels the degree-16 term. The remainder starts with and ends with . Dividing it by gives a monic with constant term .
Repeat this division. In this example the degree drops by one each time, so every step has the form
where is the leading coefficient of the remainder before we make it monic. Here are the first three steps:
| Quotient | Leading coefficient | Constant term | |
|---|---|---|---|
| 16 | |||
| 15 | |||
| 14 |
Why keep the ‘s? At each root of , the division identity says that has the same value as . For a monic first polynomial, the resultant is the product of the second polynomial’s values at those roots. There are roots counted with multiplicity, so this step contributes a factor of . Swapping the order of two consecutive degrees introduces no minus sign: is even.
Continue down to . Restoring the factor of we took out of gives
The product is the integer
It is prime. That is a separate arithmetic fact, not something a resultant guarantees; the SageMath check below verifies it. Since the original gcd divides , it can only be or . We still have to find out when it is .
Where does that prime occur?
Run the polynomial Euclidean algorithm again, this time with coefficients modulo . Over the rationals the last nonzero remainder was a constant. Modulo that constant remainder vanishes before normalization, so the algorithm stops one step earlier. Its last monic nonzero remainder is the linear polynomial
The constant comes from the same long division as the table. Set in each division identity to track the constant terms:
Stop at the linear term and reduce its constant coefficient modulo . The result is .
Now is a common root modulo exactly when divides both polynomials, or equivalently when it divides their gcd . That leaves just one residue class: . Since , its least positive member is
Substituting proves it is a counterexample. The residue class proves it is the first: the positive counterexamples are . At each one the gcd is exactly ; at every integer in between it is .
Check the arithmetic in SageMath
This computes both the divisor and the input from the polynomials. Neither 52-digit number is an input to the calculation.
from sage.all import GF, ZZ, PolynomialRing, gcd
x = PolynomialRing(ZZ, "x").gen()F = x**17 + 9H = (x + 1)**17 - x**17P = F.resultant(H)assert P.is_prime(proof=True)
K = GF(P)d = F.change_ring(K).gcd(H.change_ring(K)).monic()assert d.degree() == 1n0 = ZZ(-d[0]) # Least nonnegative representative of the rootassert gcd(F(n0), F(n0 + 1)) == Pprint(P, d, n0, sep="\n")