Let pn be the largest prime divisor of n4+n2+1 and let qn be the largest prime divisor of n2+n+1. Then pn=qn2, and from
n4+n2+1=(n2+1)2−n2=(n2−n+1)(n2+n+1)=((n−1)2+(n−1)+1)(n2+n+1)
it follows that pn=max{qn,qn−1} for n≥2. Keeping in mind that n2−n+1 is odd, we have
gcd(n2+n+1,n2−n+1)=gcd(2n,n2−n+1)=gcd(n,n2−n+1)=1.
Therefore, qn=qn−1.
To prove the result, it suffices to show that the set
S={n∈Z≥2∣qn>qn−1 and qn>qn+1}
is infinite, since for each n∈S one has
pn=max{qn,qn−1}=qn=max{qn,qn+1}=pn+1.
Suppose on the contrary that S is finite. Since q2=7<13=q3 and q3=13>7=q4, the set S is non-empty. Since it is finite, we can consider its largest element, say m.
Note that it is impossible that qm>qm+1>qm+2>… because all these numbers are positive integers, so there exists a k≥m such that qk<qk+1 (recall that qk=qk+1).
Next observe that it is impossible to have qk<qk+1<qk+2<…, because
q(k+1)2=pk+1=max{qk,qk+1}=qk+1,
so let us take the smallest l≥k+1 such that ql>ql+1. By the minimality of l we have ql−1<ql, so l∈S. Since l≥k+1>k≥m, this contradicts the maximality of m, and hence S is indeed infinite.