Prime Splitting via Recurrences
Published:
We show that a prime \(p\ne3\) is of the form \(X^2+23Y^2\) if and only if \(p\) divides \(P_{p+1}-2\), where \(\{P_n\}_n\) is the Perrin sequence.
Theorem. Define the Perrin sequence \(\{P_n\}_n\) by \((P_0,P_1,P_2)=(3,0,2)\) and \(P_{n+3}=P_{n+1}+P_n\) for each \(n\ge0\). For a prime \(p\ne3\), the following are equivalent.
- There are integers \(X\) and \(Y\) for which \(p=X^2+23Y^2\);
- The integer \(P_{p+1}-2\) is divisible by \(p\).
As will be obvious from the proof of Theorem, there is not much special about the Perrin sequence. This blog post is inspired by Corollary 10 of this paper by Moree and Noubissie.
We will assume algebraic number theory throughout. We will also use some global class field theory, but no deep understanding of class field theory is necessary.
Remark. The reason for using \(23\) is that primes of the form \(X^2+dY^2\) for small \(d\) can frequently be understood using “modular conditions” on \(p\). This is not possible for \(X^2+23Y^2\). For experts, the issue is that the Hilbert class field of \(\mathbb Q(\sqrt{-23})\) is not abelian over \(\mathbb Q\) and thus not contained in a cyclotomic field; see Lemma for a slight elaboration on this.
The Hilbert Class Field
As a preliminary aside, we compute the Hilbert class field of \(\mathbb Q(\sqrt{-23})\), which will be used in the sequel. For the hurried reader, this calculation can be safely skipped; the answer is Proposition.
Definition. Fix a number field \(K\). Then the Hilbert class field of \(K\) is the maximal everywhere unramified abelian extension of \(K\).
Remark. The composite of unramified extensions is unramified, and the same holds for abelian extensions, so such a field exists.
Example. The Hilbert class field of \(\mathbb Q\) is \(\mathbb Q\). Indeed, for any number field \(K\) strictly extending \(\mathbb Q\), the Minkowski bound implies \(\left|\operatorname{disc}K\right|>1\), and any rational prime dividing the discriminant ramifies in \(K\), so \(K/\mathbb Q\) is a ramified extension.
A priori, it is not obvious that the Hilbert class field is finite. This follows from global class field theory.
Proposition. Fix a number field \(K\) with Hilbert class field \(H\). Then \([H:K]\) is the class number of \(K\).
Sketch. We are not interested in introducing global class field theory here, so we will only say enough to appease experts. Roughly speaking, the point is that \(\operatorname{Gal}(H/K)\) corresponds, via the global Artin map, with the quotient \[K^\times\backslash\mathbb A_K^{\infty,\times}\bigg/\prod_{v\nmid\infty}\mathcal O_{K_v}^\times.\] By factoring fractional ideals, this quotient can be identified with the class group. \(\blacksquare\)
Thus, we have an approach to computing a Hilbert class field: compute the class number to find an upper bound for the degree, and then hunt for an everywhere unramified abelian extension with the required degree. Let’s execute this for \(\mathbb Q(\sqrt{-23})\).
Lemma. The class number of \(\mathbb Q(\sqrt{-23})\) is \(3\).
Proof. Set \(K:=\mathbb Q(\sqrt{-23})\) for brevity. The Minkowski bound is \[M_K=\sqrt{\left|\operatorname{disc}K\right|}\cdot\left(\frac4\pi\right)^{r_2}\cdot\frac{n!}{n^n},\] where \(r_2=1\) is the number of complex places, and \(n=2\) is the degree. Thus, \(M_K=\frac2\pi\sqrt{23}<\frac23\cdot5<4\).
It follows that we only have to worry about factoring the primes \(2\) and \(3\), for which we use Dedekind–Kummer. Note that \(\mathcal O_K=\mathbb Z[(-1+\sqrt{-23})/2]\), and the element \(\omega:=(-1+\sqrt{-23})/2\) has minimal polynomial \(X^2+X+6\). Notably, \(X^2+X+6\equiv X(X+1)\pmod6\), so both \(2\) and \(3\) split in \(K\); write \((2)=\mathfrak p\overline{\mathfrak p}\) and \((3)=\mathfrak q\overline{\mathfrak q}\), where \(\mathfrak p:=(2,\omega)\) and \(\mathfrak q:=(3,\omega)\).
By the Minkowski bound, these primes generate the class group. We now hunt for relations.
- Note that \(\mathfrak p\mathfrak q=\left(6,2\omega,3\omega,\omega^2\right)=(\omega)\), so these primes are inverse in the class group.
- Because \(\mathcal O_K\) has no elements of norm \(2\) (equivalently, the quadratic form \(X^2+XY+6Y^2\) does not represent \(2\)), the primes \(\mathfrak p\) and \(\overline{\mathfrak p}\) are non-principal.
- We claim that \(\mathfrak p^3\) is principal. Indeed, \(\omega+2\) has norm \(8\), so \((\omega+1)=\mathfrak p^a\overline{\mathfrak p}{}^b\) for some pair \((a,b)\) of nonnegative integers with \(a+b=3\). On one hand, \(a>0\) because \(\omega+2\in\mathfrak p\). On the other hand, \(\omega+1\) is not divisible by \(2\), so we cannot have both \(a>0\) and \(b>0\). Thus, \(\mathfrak p^3=(\omega+2)\).
It follows that the class group is generated by \(\mathfrak p\), which is nontrivial but cubes to the trivial class. Thus, the class group is \(\mathbb Z/3\mathbb Z\). \(\blacksquare\)
Proposition. The Hilbert class field of \(\mathbb Q(\sqrt{-23})\) is \[\frac{\mathbb Q(\sqrt{-23})[\alpha]}{\left(\alpha^3-\alpha-1\right)}.\]
Proof. For brevity, set \(K:=\mathbb Q(\sqrt{-23})\) and \(L:=\mathbb Q[\alpha]/\left(\alpha^3-\alpha-1\right)\). Using the Rational root theorem, we see that \(T^3-T-1\) is an irreducible polynomial, so \(L\) is a cubic extension of \(\mathbb Q\); for degree reasons, \(L\) and \(K\) are linearly disjoint, so \([KL:K]=3\).
By combining Proposition with Lemma, we see that it is enough to show that \(KL/K\) is an everywhere unramified abelian extension. Showing that it is abelian is not so hard: for degree reasons, it is enough to show that \(KL/K\) is Galois. The discriminant of the cubic polynomial \(T^3-T-1\) is \(-23\), so the splitting field of \(T^3-T-1\) (which is the Galois closure of \(L\)) must contain \(\sqrt{-23}\). Thus, the Galois closure of \(L\) contains \(KL\). On the other hand, the Galois closure of \(L\) has Galois group contained in \(S_3\), so the degree is at most six (over \(\mathbb Q\)), so we conclude that the Galois closure of \(L\) is \(KL\).
It remains to show that \(KL/K\) is everywhere unramified. Most places are easy to handle. Because \(K\) is totally imaginary, there are no issues at the archimedean places. Also, for any rational prime \(p\) away from \(23\), we know \(p\) is unramified in \(L\) and hence in the Galois closure \(KL\). Thus, for any prime \(\mathfrak p\) of \(K\) away from \(23\), we know \(\mathfrak p\) is unramified in \(KL\).
It remains to handle the prime \(\mathfrak p:=(\sqrt{-23})\) of \(K\) above \(23\). The idea is to compare this situation with the factorization of \(23\) in \(L\). Because \(KL/K\) is Galois, all ramification indices and inertial degrees of the primes above \(\mathfrak p\) are equal. Thus, either \(\mathfrak p\mathcal O_{KL}\) splits completely, or \(\mathfrak p\mathcal O_{KL}\) has a single prime factor.
However, we claim that there is more than one prime above \(23\) in \(L\). We will use Dedekind–Kummer. Note that \([\mathcal O_L:\mathbb Z[\alpha]]^2\) divides the discriminant of \(\alpha\), which is \(-23\), so we conclude \(\mathcal O_L=\mathbb Z[\alpha]\). Thus, to factor \(23\), we note \[T^3-T-1\pmod{23}\] has the distinct roots \(3\) and \(10\), so there is more than one prime above \(23\) in \(L\). \(\blacksquare\)
Remark. The proof shows that the Hilbert class field of \(\mathbb Q(\sqrt{-23})\) is the splitting field of the polynomial \(T^3-T-1\).
Using Class Field Theory
We begin by recalling the classical arguments in class field theory which allow us to understand the condition that \(p\) is of the form \(X^2+23Y^2\). Many of the arguments carry through more generally to understand when a prime \(p\) is of the form \(X^2+nY^2\).
Lemma. Fix a rational prime \(p\ne23\). Then the following are equivalent.
- There are integers \(X\) and \(Y\) for which \(p=X^2+23Y^2\).
- The prime \(p\) splits in \(\mathbb Q(\sqrt{-23})\), and the factors are principal.
Proof. For brevity, set \(K:=\mathbb Q(\sqrt{-23})\) and \(\omega:=(-1+\sqrt{-23})/2\) so that \(\mathcal O_K=\mathbb Z[\omega]\). That 1 implies 2 is easier: to have \(p=X^2+23Y^2\), we see that \[p\mathcal O_K=\left(X+Y\sqrt{-23}\right)\left(X-Y\sqrt{-23}\right)\] in \(\mathcal O_K\). Thus, \(p\) splits, and the factors are principal.
The previous paragraph indicates to us how to show 2 implies 1. (Namely, it indicates where \(X\) and \(Y\) should arise.) Given 2, we may let \((a+b\omega)\) be one of the factors of \((p)\). Taking norms, we see \[4p=(2a-b)^2+23b^2.\] It only remains to show that both \(2a-b\) and \(b\) are even; equivalently, we want to show that \(b\) is even. Well, suppose for the sake of contradiction that \(b\) is odd. Then the right-hand side is \(0\pmod8\), so \(p\) is even, so \(p=2\). However, the proof of Proposition showed that the factors of \(2\mathcal O_K\) are not principal, so the hypothesis is already false for \(p=2\). \(\blacksquare\)
To continue, we need the following piece of class field theory.
Proposition. Fix a number field \(K\) with Hilbert class field \(H\). Then a prime ideal \(\mathfrak p\) of \(K\) is principal if and only if it splits completely in \(H\).
Sketch. Again, we only provide a sketch to appease experts. As before, the idea is to use the global Artin map \[\operatorname{Gal}(H/K)\cong K^\times\backslash\mathbb A_K^{\infty,\times}\bigg/\prod_{v\nmid\infty}\mathcal O_{K_v}^\times.\] Namely, \(\mathfrak p\) splits completely if and only if its Frobenius \(\mathrm{Frob}_{\mathfrak p}\) is the identity. Via the Artin map, this corresponds to \(\mathfrak p\) having a generator. \(\blacksquare\)
Lemma. Fix a rational prime \(p\ne23\). Then the following are equivalent.
- There are integers \(X\) and \(Y\) for which \(p=X^2+23Y^2\).
- The prime \(p\) splits completely in the Hilbert class field of \(\mathbb Q(\sqrt{-23})\).
Proof. By Lemma, we only need to compare the second conditions. This comparison follows by Proposition. In short, \(p\) splits completely in the Hilbert class field of \(\mathbb Q(\sqrt{-23})\) if and only if \(p\) splits completely in \(\mathbb Q(\sqrt{-23})\) with each factor splitting completely in the Hilbert class field. \(\blacksquare\)
We now use our calculation of the Hilbert class field.
Lemma. Fix a rational prime \(p\ne23\). Then the following are equivalent.
- There are integers \(X\) and \(Y\) for which \(p=X^2+23Y^2\).
- The polynomial \(T^3-T-1\) splits into distinct linear factors\(\pmod p\).
Proof. We compare the second condition with Lemma using Dedekind–Kummer. Set \(K:=\mathbb Q(\sqrt{-23})\) and \(L:=\mathbb Q[\alpha]/\left(\alpha^3-\alpha-1\right)\) so that \(KL\) is the Hilbert class field of \(K\) by Proposition. In fact, the proof of Proposition also shows that \(KL\) is the Galois closure of \(L\) and shows that \(\mathcal O_L=\mathbb Z[\alpha]\). Thus, \(p\) splits completely in \(KL\) if and only if \(p\) splits completely in \(L\), which by Dedekind–Kummer is equivalent to \(T^3-T-1\pmod p\) splitting into distinct linear factors. \(\blacksquare\)
Remark. Because \(23\) is the only ramified rational prime in \(KL\), when \(p\ne23\), having \(X^3-X-1\pmod p\) split into distinct linear factors is equivalent to merely splitting into linear factors. Accordingly, we could allow \(p=23\) into the statement of Lemma by removing the word “distinct.”
The Perrin Sequence
We now understand the condition that \(p\) takes the form \(X^2+23Y^2\). It remains to understand the Perrin sequence. Luckily, this is easier. The main point is that the characteristic polynomial of the Perrin sequence is \(T^3-T-1\), which allows us to relate the Perrin sequence to our prior discussion.
Lemma. Let \(\{\alpha,\beta,\gamma\}\) be the roots of \(T^3-T-1\). Then for each nonnegative integer \(n\), we have \[P_n=\alpha^n+\beta^n+\gamma^n.\]
Proof. We proceed by induction. Define the sequence \(\{P’_n\}_n\) by \(P’_n:=\alpha^n+\beta^n+\gamma^n\) for each nonnegative integer \(n\), so we are interested in checking that \(P_n=P’_n\) for each \(n\).
For any root \(\theta\) of \(T^3-T-1\), we see that the sequence \(Q_n:=\theta^n\) satisfies \(\theta^{n+3}=\theta^{n+1}+\theta^n\) and hence \(Q_{n+3}=Q_{n+1}+Q_n\). Summing, we see that \[P’_{n+3}=P’_{n+1}+P’_n\] for each \(n\). Thus, by an induction, it is enough to check that \(P_n=P’_n\) for \(n\in\{0,1,2\}\), which we do by hand. For example, \(P’_0=1+1+1=3\), and \(P’_1=\alpha+\beta+\gamma=0\) by Vieta’s formulae. Lastly, \(P’_2=\alpha^2+\beta^2+\gamma^2\) equals \((\alpha+\beta+\gamma)^2-2(\alpha\beta+\beta\gamma+\gamma\alpha)\), which is \(0^2-2\cdot-1=2\). \(\blacksquare\)
This allows us to quickly handle one direction of Theorem (with the help of Lemma).
Lemma. Fix a rational prime \(p\). Suppose the polynomial \(T^3-T-1\) splits into linear factors\(\pmod p\). Then \(P_{p+1}\equiv2\pmod p\).
Proof. By hypothesis, the three roots \(\alpha\), \(\beta\), and \(\gamma\) of \(T^3-T-1\) (enumerated with multiplicity) live in \(\mathbb F_p\). Thus, they are fixed by the Frobenius automorphism, so \[\begin{aligned}P_{p+1} &= \alpha^{p+1}+\beta^{p+1}+\gamma^{p+1} \\\
&\equiv \alpha^2+\beta^2+\gamma^2 \\\
&= P_2 \\\
&= 2,\end{aligned}\] as desired. \(\blacksquare\)
The rest of the proof of Theorem essentially follows by upgrading this argument. Namely, the splitting behavior of \(T^3-T-1\pmod p\) determines how \(\mathrm{Frob}_p\) acts on the roots of \(T^3-T-1\). Lemma handles the case where \(\mathrm{Frob}_p\) acts as the identity, so it only remains to consider the other possible permutations.
Lemma. Fix a rational prime \(p\ne3\). Suppose the polynomial \(T^3-T-1\) does not split into linear factors\(\pmod p\). Then \(P_{p+1}\not\equiv2\pmod p\).
Proof. By hypothesis, the three roots \(\alpha\), \(\beta\), and \(\gamma\) of \(T^3-T-1\) do not all live in \(\mathbb F_p\). Thus, the Frobenius automorphism acts by a nontrivial permutation. Thus, there are two cases: either Frobenius acts by a \(3\)-cycle or by a transposition.
The case of a \(3\)-cycle is easier: without loss of generality, suppose \((\alpha^p,\beta^p,\gamma^p)\equiv(\beta,\gamma,\alpha)\). Then \[\begin{aligned}P_{p+1} &= \alpha^{p+1}+\beta^{p+1}+\gamma^{p+1} \\\
&\equiv \alpha\beta+\beta\gamma+\gamma\alpha \\\
&= -1,\end{aligned}\] as desired. Note that we are using \(p\ne3\) here!
Lastly, suppose that Frobenius acts by a transposition. Without loss of generality, suppose \((\alpha^p,\beta^p,\gamma^p)\equiv(\beta,\alpha,\gamma)\). Arguing as in the previous paragraph, we see \(P_{p+1}\equiv2\alpha\beta+\gamma^2\). We now have to make an argument to show that this is not \(2\pmod p\). Well, \(\alpha^2+\beta^2+\gamma^2=2\), so \[P_{p+1}-2\equiv-(\alpha-\beta)^2.\] For Frobenius to be acting by transposition, we must have \(\alpha\ne\beta\), so this is indeed nonzero. \(\blacksquare\)
Remark. The case where Frobenius acts by transposition appears to be a rather delicate argument, but this is only done to make the argument human-checkable. A less delicate argument would be to (use a computer to) compute \[\operatorname N_{\mathbb Q(\alpha,\beta,\gamma)/\mathbb Q}\left(2\alpha\beta+\gamma^2-2\right)=529.\] Thus, \(2\alpha\beta+\gamma^2-2\equiv0\) implies \(529\equiv0\) and so \(p=23\).
The proof of Lemma now follows by combining Lemma (and Remark) with Lemma and Lemma.
AI Disclosure. ChatGPT was used to check for grammatical and mathematical errors. It also optimized the calculation in Lemma.