A Sufficient Condition for the Primality of the Sum of Two Squares ()
1. Introduction
Legendary mathematician Pierre de Fermat wrote to his friend on December 25, 1640 that any Pythagorean prime can be expressed as the sum of the squares of two integers [1]. This statement is known as Fermat’s Christmas Theorem or Fermat’s Sum of Two Squares Theorem, one of the most significant propositions in mathematics [2]-[4]. However, it remains largely an open and unsolved problem to find sufficient conditions for the primality of a (
)-type of integer to be expressed as a sum of two squares.
Aletheia-Zomlefer [5] states that prime values of quadratic polynomials are conjectural in general. Cox [2] studies to determine which primes can be represented in quadratic forms, indicating that to claim under what conditions a sum of squares will be prime requires analytic conjectures. Iwaniec and Kowalski [6] also emphasize that the general problem of prime values of polynomials, including quadratic cases, remains open.
Pinz [7] indicates that Landau’s problem of
type is a long-standing challenge. Jacobi [8] [9] demonstrates that if an integer n has every (
)-type prime factor occurring to an even power, then the number of representations of n as a sum of two squares is
, where
and
denote the numbers of (
)-type and (
)-type divisors of n; however, Jacobi’s theorem does not specify any conditions implying the primality. Jacobi’s formula specifies the number of sum-of-squares representations, which is not the focus of this study.
This brief report sets out when a (
)-type integer expressed in a sum of two squares becomes prime. Our finding provides a characterization of primes
(mod 4) in terms of the uniqueness of sum-of-squares representation. This is a rather elegant result.
2. Preliminaries
Before diving into the main theorem and its proof, we recall some of the well-known results as background knowledge.
Fermat’s Sum of Two Squares Theorem [4] (Fact 1) states that an odd prime
can be written as a sum of two squares if and only if
(mod 4). Moreover, when such a representation exists, it is unique up to order and signs.
General Representability [4] (Fact 2) states that a positive integer
can be expressed as a sum of two squares if and only if every prime factor of
that is congruent to 3 (mod 4) appears to an even power.
Brahmagupta-Fibonacci Identity [4] (Fact 3) states that the product of two sums of squares is itself a sum of squares, which may appear in two different expressions:
for real numbers
.
This identity is the engine that generates multiple representations for composite numbers.
3. Main Theorem
Theorem Let
be a square-free positive integer and
(mod 4). If
has a unique representation as the sum of two squares (up to order and signs) for a pair of positive integers
and
, then
is prime.
Proof:
First, notice that if
and
, then
divides
. But
is square free, so no perfect square greater than 1 can divide it. Therefore,
holds automatically.
We now take a contrapositive proof: if
satisfies all the given conditions but is composite, then
has more than one distinct representation as a sum of two squares.
(Step 1): Let us determine the prime factors of
.
Suppose
satisfies our hypotheses:
(mod 4),
is square free, and
;
for some integers with
. Since
is square free (no prime appears more than once), we have the factorization:
with each
being a distinct prime for
.
Let us check what kinds of primes can divide
.
(i) It is easy to see that no prime
(mod 4) or
(mod 4) can divide
. (ii) Since
is expressible as a sum of two squares, Fact 2 tells that any prime
(mod 4) dividing
must appear to be an even power. However,
is square-free, therefore no prime
(mod 4) can divide a at all. Therefore, every prime factor of
must be congruent to 1 (mod 4). In other words,
where each
is a distinct prime with
(mod 4).
(Step 2): Let us count possible sum-of-squares representations of
.
This counting work follows the basics of [2] [4] [7] easily. By Fermat’s Two-Square Theorem (Fact 1), each prime
(mod 4) has a unique representation
.
When we multiply two sums of squares using the Brahmagupta-Fibonacci identity (Fact 3), we get a binary choice at each step. Specifically, if we have built up a representation for
, say
for some non-zero integers
and
, and incorporate
, we then have
or
.
These two choices yield different representations.
Starting with
(one representation), at each subsequent prime, we double the number of representations. After incorporating all
primes, we have
distinct representations. (The factor is
rather than
because we start with one representation and make
binary choices.) ■
(Step 3): Let us finish the proof of our theorem.
Suppose
satisfies all the hypotheses and has a unique representation as a sum of two squares.
From Step 1, we know
where all
(mod 4) are distinct. Moreover, from Step 2, we know the number of distinct representations is
.
Since
is assumed to have a unique representation, we have
.
Consequently,
consists of a single prime factor, which means
is prime.
4. Conclusions
The beautiful insight here is that the Brahmagupta-Fibonacci identity acts as a “representation multiplier”. Each time we multiply two numbers expressible as sums of squares, we get a choice of how to combine them, which creates additional representations. A prime has exactly one representation, and each additional prime factor in a square-free product doubles the count. It elaborates classical theorems, including representations by quadratic forms.
The conditions
(mod 4) and square-free work together to ensure that all prime factors are
(mod 4), which puts in exactly the setting where this counting argument applies cleanly. This theorem gives us a characterization of primes
(mod 4) in terms of the uniqueness of their sum-of-squares representation, which is a rather elegant result.
Acknowledgements
This research is supported in part by City University of Hong Kong project No. 9610556. We acknowledge Nianrui Lin, an anonymous reviewer, and ChatGPT for providing input to the reference list.