671 字
3 分钟
An Example Is Not a Proof: Why the First Counterexample Has 52 Digits

Consider a puzzle shared by @sphere_homotopy on X: write down the sequence 117+9, 217+9, 317+9,…1^{17}+9,\ 2^{17}+9,\ 3^{17}+9,\ldots. The first two terms are 1010 and 131081131081, so their gcd is 11. Is every pair of neighbors coprime? In other words, is it true that

gcd⁡ ⁣(n17+9, (n+1)17+9)=1for all n≥1?\gcd\!\left(n^{17}+9,\,(n+1)^{17}+9\right)=1 \qquad\text{for all } n\ge 1?

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:

F(x)=x17+9,H(x)=(x+1)17−x17.F(x)=x^{17}+9,\qquad H(x)=(x+1)^{17}-x^{17}.

If a prime pp divides both terms at nn, then F(n)≡H(n)≡0(modp)F(n)\equiv H(n)\equiv 0\pmod p. To eliminate nn, we use the resultant R=Res⁡(F,H)R=\operatorname{Res}(F,H). The useful fact about RR is that it is a fixed integer with an identity

R=A(x)F(x)+B(x)H(x),A,B∈Z[x].R=A(x)F(x)+B(x)H(x),\qquad A,B\in\mathbb Z[x].

Put x=nx=n. Any common divisor of F(n)F(n) and H(n)H(n) must divide the right-hand side, so it must divide RR. 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 11. Start with E17=FE_{17}=F and

E16=H17=x16+8x15+40x14+⋯+117.E_{16}=\frac{H}{17}=x^{16}+8x^{15}+40x^{14}+\cdots+\frac{1}{17}.

Divide E17E_{17} by E16E_{16}. The quotient is x−8x-8: the xx cancels the degree-17 term and the −8-8 cancels the degree-16 term. The remainder starts with (8⋅8−40)x15=24x15(8\cdot 8-40)x^{15}=24x^{15} and ends with 9+8/17=161/179+8/17=161/17. Dividing it by 2424 gives a monic E15E_{15} with constant term 161/408161/408.

Repeat this division. In this example the degree drops by one each time, so every step has the form

Ek+1=(x+uk)Ek+vkEk−1,E_{k+1}=(x+u_k)E_k+v_k E_{k-1},

where vkv_k is the leading coefficient of the remainder before we make it monic. Here are the first three steps:

kkQuotient x+ukx+u_kLeading coefficient vkv_kConstant term Ek−1(0)E_{k-1}(0)
16x−8x-82424161/408161/408
15x+1/2x+1/219/419/4−113/3876-113/3876
14x+1/2x+1/222793/3876793/3876

Why keep the vkv_k‘s? At each root of EkE_k, the division identity says that Ek+1E_{k+1} has the same value as vkEk−1v_k E_{k-1}. For a monic first polynomial, the resultant is the product of the second polynomial’s values at those roots. There are kk roots counted with multiplicity, so this step contributes a factor of vkkv_k^k. Swapping the order of two consecutive degrees introduces no minus sign: k(k+1)k(k+1) is even.

Continue down to E0=1E_0=1. Restoring the factor of 1717 we took out of HH gives

R=1717∏k=116vk k.R=17^{17}\prod_{k=1}^{16}v_k^{\,k}.

The product is the integer

P=8936582237915716659950962253358945635793453256935559.P=8936582237915716659950962253358945635793453256935559.

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 PP, it can only be 11 or PP. We still have to find out when it is PP.

Where does that prime occur?#

Run the polynomial Euclidean algorithm again, this time with coefficients modulo PP. Over the rationals the last nonzero remainder was a constant. Modulo PP that constant remainder vanishes before normalization, so the algorithm stops one step earlier. Its last monic nonzero remainder is the linear polynomial

gcd⁡FP[x](F,H)=x+C,C=512149312322827330662764931050044963334032796143126.\gcd_{\mathbb F_P[x]}(F,H)=x+C,\qquad C=512149312322827330662764931050044963334032796143126.

The constant CC comes from the same long division as the table. Set x=0x=0 in each division identity to track the constant terms:

Ek−1(0)=Ek+1(0)−ukEk(0)vk.E_{k-1}(0)=\frac{E_{k+1}(0)-u_k E_k(0)}{v_k}.

Stop at the linear term E1=x+E1(0)E_1=x+E_1(0) and reduce its constant coefficient modulo PP. The result is CC.

Now nn is a common root modulo PP exactly when x−nx-n divides both polynomials, or equivalently when it divides their gcd x+Cx+C. That leaves just one residue class: n≡−C(modP)n\equiv -C\pmod P. Since 0<C<P0<C<P, its least positive member is

n0=P−C=8424432925592889329288197322308900672459420460792433.n_0=P-C=8424432925592889329288197322308900672459420460792433.

Substituting n0n_0 proves it is a counterexample. The residue class proves it is the first: the positive counterexamples are P−C, 2P−C, 3P−C,…P-C,\ 2P-C,\ 3P-C,\ldots. At each one the gcd is exactly PP; at every integer in between it is 11.

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 + 9
H = (x + 1)**17 - x**17
P = 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() == 1
n0 = ZZ(-d[0]) # Least nonnegative representative of the root
assert gcd(F(n0), F(n0 + 1)) == P
print(P, d, n0, sep="\n")