# Fundamental Barriers in Geometric Primality Testing: A Synthesis of Galois Theory, Transcendence, and Computational Limits

Youssef Ayyad, Ali Ayad

► To cite this version:

Youssef Ayyad, Ali Ayad. Fundamental Barriers in Geometric Primality Testing: A Synthesis of Galois Theory, Transcendence, and Computational Limits. 2026. hal-05479509

HAL Id: hal-05479509

https://hal.science/hal-05479509v1

Preprint submitted on 27 Jan 2026

**HAL** is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# Fundamental Barriers in Geometric Primality Testing: A Synthesis of Galois Theory, Transcendence, and Computational Limits

Youssef Ayyad*
and
Ali Ayad†

January 26,2026

## Abstract

We prove that any deterministic primality test based on finite geometric constructions or bounded modular sampling must fail for density-one sets of integers. Our main theorems establish: (1) an $\Omega(\sqrt{n})$ lower bound on numerical instability arising from the transcendence of $\pi$; (2) a Galois-theoretic barrier showing that tests examining $O(\log^k n)$ samples cannot decide primality for all sufficiently large $n$; (3) constructibility barriers via Gauss-Wantzel, making exact geometric realizations impossible for almost all primes; and (4) model-theoretic impossibility results via o-minimality. These results unify geometric and modular approaches under a single framework, revealing that primality's continuous nature resists complete discrete characterization. The work synthesizes techniques from transcendence theory, Galois theory, model theory, and computational complexity.

**Declaration:** This work was conducted without the use of artificial intelligence or large language model tools. All theorems, proofs, and mathematical content are the original work of the author.

## 1 Introduction: The Eternal Tension Between Discrete and Continuous

Since the dawn of mathematics, a profound tension has existed between the discrete and the continuous. The ancient Greeks grappled with this dichotomy: Zeno's paradoxes questioned motion, Euclid's elements established geometry, while Pythagoreans worshipped numbers. In primality testing, this tension manifests acutely—we seek to determine the indivisibility of integers (a discrete property) using methods that inevitably involve continuous approximations.

<footnote>*Associate Professor, Lebanese University, Faculty of Sciences. Email: ayyadyoussef@hotmail.com</footnote>

<footnote>†Professor, Lebanese University, Faculty of Sciences. Email: ali.ayad@ul.edu.lb</footnote>
<figure><img src="image_2.png" /><figcaption>The heptagon approximates the circle, but vertices remain discrete points</figcaption></figure>

Figure 1: The fundamental approximation: discrete polygons inscribed in continuous circles.

Recent geometric approaches to primality testing [2] have proposed elegant frameworks based on inscribed polygons and analytic manifolds. These methods characterize primes through beautiful geometric properties: the non-inscribability of proper subpolygons, the area remainder $R(n)$ between circle and polygon, and the $\mathcal{R}_\pi$ manifold embedding $\Phi(n) = \sqrt{n}e^{i\sqrt{n\pi}}$. While computationally suggestive for moderate numbers, these approaches raise deeper questions about their theoretical viability.

While recent breakthroughs like the Green–Tao theorem [16] reveal additive structure in primes, our work examines why their *multiplicative indivisibility*—the very definition of primality—resists geometric characterization. This complements the AKS algorithm [12] which shows primality is computationally tractable but not geometrically simple.

In this paper, we undertake a comprehensive investigation through four interconnected analytical tracks:

1. **Algebraic Formalization**: Translating geometric intuition into exact algebraic language

2. **Constructibility Analysis**: Determining which geometric objects can be precisely realized

3. **Counterexample Construction**: Exhibiting cases where geometric methods provably fail

4. **Impossibility Theorems**: Establishing fundamental barriers to any discrete approach

Our investigation reveals that the limitations encountered by geometric methods are not isolated phenomena but manifestations of deeper principles connecting Galois theory, transcendence theory, and computational complexity. The geometric approach fails not because it is geometric, but because it is discrete—and all discrete methods face similar barriers when confronting continuous reality.
## 1.1 Historical Echoes and Philosophical Continuity

The story we tell resonates with historical breakthroughs in understanding mathematical limitations. Galois' demonstration that quintic equations cannot be solved by radicals [5] revealed algebraic closure. Gauss' characterization of constructible polygons [6] connected geometry to number theory. Lindemann's proof of $\pi$'s transcendence [7] settled the ancient problem of squaring the circle. Each showed that certain problems have no solution within given frameworks.

Our work extends this tradition to primality testing, showing that the search for a perfect discrete test encounters barriers analogous to those faced by algebraists seeking radical solutions or geometers seeking exact constructions. The common thread is the tension between discrete manipulation and continuous truth.

## 1.2 Main Contributions and Narrative Structure

This paper makes several interconnected contributions, presented not as a list of results but as a coherent narrative about the nature of mathematical computation:

1. We provide a complete algebraic formalization of geometric primality tests, revealing their inherent transcendental nature and connecting them to classical Galois theory.

2. We demonstrate that almost all prime polygons are non-constructible, establishing a geometric barrier analogous to the algebraic barrier for solving high-degree equations.

3. We construct systematic counterexamples showing that geometric methods must fail for infinitely many numbers, with explicit bounds on their numerical instability.

4. We prove impossibility theorems showing that no finite geometric construction can decide primality for all integers, connecting this to o-minimality and model theory.

5. Most importantly, we synthesize these results into a unified perspective: *primal-ity is inherently continuous, and any discrete approximation—geometric or modular—must necessarily be imperfect.*

The paper unfolds as a journey from specific geometric constructions to general principles about computation. We begin with concrete polygons, ascend to abstract algebra, encounter barriers in constructibility, witness failures through counterexamples, and finally arrive at fundamental impossibility theorems. The narrative culminates in a philosophical reflection on what this means for our understanding of primality and computation.

## Related Work

The dialogue between geometry and number theory has ancient roots, but our work connects specifically to several modern research strands:

* **Geometric approaches to primes:** The program of visualizing primes geometrically dates to [2, 3], which introduced the $\mathcal{R}_\pi$ manifold and fractal polygon constructions. Our impossibility results complement these constructive attempts by establishing fundamental barriers.
* **Computational complexity of primality:** The breakthrough AKS algorithm [12] showed primality is in P, but our work reveals why *geometric* approaches can't achieve polynomial time—a distinction between algebraic and geometric computability.

* **Transcendence and computation:** Baker's foundational work [14, 4] on transcendental number theory provides tools for our impossibility proofs, particularly Theorem 6.4 on threshold existence.

* **Model theory and definability:** The o-minimality results of [13, 10] underpin our main impossibility theorem (Theorem 6.1), showing primes are not definable in certain geometric languages.

* **Structural properties of primes:** While [16] reveals deep additive structure in primes, our work explores why their *multiplicative* indivisibility resists geometric characterization.

* **Diophantine representation:** Jones and Sato [15] show primes can be represented by polynomial Diophantine equations, contrasting with our negative results about geometric representations.

Our contribution synthesizes these strands: we use model theory to prove geometric impossibility, transcendence theory to bound numerical stability, and computational complexity to unify geometric and modular approaches. While previous work either constructed specific tests or analyzed their complexity, we establish why entire classes of geometric methods must fail.

# 2 Geometric Foundations: From Polygons to Manifolds

Mathematics begins with seeing. Before equations, there is geometry; before algorithms, there are shapes. Our geometric approach to primality starts with the simple, beautiful act of inscribing polygons in circles—an ancient pursuit that turns out to encode deep arithmetic truths.

## 2.1 The Language of Regular Polygons

**Definition 2.1 (Regular Polygon Space).** For $n \in \mathbb{N}$, $n \ge 3$, let $P_n$ denote the regular polygon with $n$ sides inscribed in the unit circle. Its vertices are precisely the $n$th roots of unity: $\zeta_n^k = e^{2\pi i k / n}$ for $k = 0, 1, \dots, n-1$. For completeness, we define $P_1$ as a degenerate point and $P_2$ as a diameter. The space of all such polygons is $\mathcal{P} = \{P_n : n \in \mathbb{N}\}$, with the natural correspondence $n \leftrightarrow P_n$ establishing a dictionary between numbers and shapes.

**Definition 2.2 (Perfect Inscription).** A polygon $P_d$ is *perfectly inscribed* in $P_n$ if every vertex of $P_d$ coincides exactly with a vertex of $P_n$. This is not merely approximate alignment but exact coincidence—a geometric manifestation of arithmetic divisibility.

The following theorem establishes the fundamental connection between geometry and arithmetic that underlies our entire approach:
**Theorem 2.3** (The Inscription-Divisibility Correspondence). $P_d$ can be perfectly inscribed in $P_n$ if and only if $d$ divides $n$ ($d \mid n$).

*Proof.* Place $P_n$ with vertices at the $n$th roots of unity: $v_k = \zeta_n^k = e^{2\pi ik/n}$.

If $d \mid n$, then $n = d \cdot m$ for some integer $m$. The vertices $\zeta_n^0, \zeta_n^m, \zeta_n^{2m}, \dots, \zeta_n^{(d-1)m}$ are equally spaced at angles $2\pi/d$ and form a regular $d$-gon perfectly inscribed in $P_n$.

Conversely, if $P_d$ is perfectly inscribed, its vertices form a subset of $\{\zeta_n^k\}$ that are equally spaced. Let the step between consecutive vertices be $m$ positions. Then $\zeta_n^m$ is a primitive $d$th root of unity, so $(\zeta_n^m)^d = \zeta_n^{md} = 1$, implying $d \mid n$. $\square$

This theorem reveals that divisibility—the arithmetic relation at the heart of primality—has a perfect geometric counterpart. From this follows a beautiful geometric characterization of prime numbers:

**Corollary 2.4** (Primality as Geometric Indivisibility). For $n > 1$, the following are equivalent:

1. $n$ is prime.

2. The only regular polygons perfectly inscribed in $P_n$ are $P_1$ and $P_n$ itself.

3. $P_n$ admits no non-trivial internal geometric subdivision.

Thus a prime polygon is geometrically *indivisible*—it cannot be broken into smaller regular components. This geometric indivisibility mirrors the arithmetic indivisibility that defines primality.

**Corollary 2.5** (Computational consequence). For $n > 2$, determining whether $d$ divides $n$ via polygon inscription requires constructing $P_n$ exactly, which by the Gauss-Wantzel theorem is possible only when $\phi(n)$ is a power of 2. For prime $p$, this occurs with probability $O(1/\log p)$ among primes.

**Remark 2.6.** The equivalence between arithmetic divisibility and geometric inscription is more than an analogy—it is an exact correspondence. This suggests that prime numbers might be understood not just as arithmetic objects but as geometric ones with specific symmetry properties. The rest of this paper explores whether this geometric perspective can be made computationally effective. For more details about the geometric construction of integers refer to [3]

## 2.2 The $\mathcal{R}_\pi$ Manifold: Geometry in the Complex Plane

Geometry becomes richer when we lift it into the complex plane. The following construction provides a continuous framework for studying our discrete polygons:

**Definition 2.7** (The $\mathcal{R}_\pi$ Manifold). Define the embedding $\Phi : \mathbb{N}^+ \to \mathbb{C}$ by:

$$ \Phi(n) = z_n = \sqrt{n} e^{i\sqrt{n\pi}} = \sqrt{n} (\cos \sqrt{n\pi} + i \sin \sqrt{n\pi}). $$

The $\mathcal{R}_\pi$ manifold is $\mathcal{R}_\pi = \{\Phi(n) : n \in \mathbb{N}^+\}$, equipped with the Riemannian metric induced from $\mathbb{C} \cong \mathbb{R}^2$:

$$ ds^2 = dr^2 + r^2 d\theta^2, \quad r = \sqrt{n}, \quad \theta = \sqrt{n\pi}. $$
This manifold provides a continuous interpolation of our discrete polygons. Each $\Phi(n)$ lies at distance $\sqrt{n}$ from the origin and at angle $\sqrt{n\pi}$—a spiral structure that encodes both the size and the "primality potential" of $n$.

<figure><img src="image_3.png" /><figcaption>Figure 2: The $\mathcal{R}_\pi$ manifold embeds integers in $\mathbb{C}$ via $\Phi(n) = \sqrt{n}e^{i\sqrt{n\pi}}$.</figcaption></figure>

## 2.3 The Area Remainder: Measuring Geometric Imperfection

When we inscribe $P_n$ in the unit circle, a small area remains between the polygon and the circle. This "geometric dust" [2] carries information about $n$:

**Definition 2.8 (Area Remainder Function).** For $n \in \mathbb{N}^+$, define:

$$R(n) = A_{\text{circle}} - A_{\text{polygon}}(n) = \pi - \frac{n}{2} \sin\left(\frac{2\pi}{n}\right),$$

where $A_{\text{circle}} = \pi$ (unit circle area) and $A_{\text{polygon}}(n) = \frac{n}{2}\sin(2\pi/n)$ (area of inscribed $n$-gon).

The function $R(n)$ measures how poorly $P_n$ approximates the circle. For composite $n$ with many divisors, $P_n$ often fits relatively well; for primes, the fit is typically worse. This observation suggests that $R(n)$ might serve as a primality indicator.

**Definition 2.9 (Geometric Primality Indicator).** For $n > 1$, define:

$$\Gamma(n) = \frac{\Psi_{\text{diff}}(n)}{\sigma_{\theta}(n) \cdot A(n) + \eta},$$

where:

* $\Psi_{\text{diff}}(n) = \left|\frac{d}{dn}\Phi(n)\right|$ measures tension on $\mathcal{R}_\pi$

* $\sigma_{\theta}(n)$ is phase variance (defined in Appendix)

* $A(n) = \frac{1}{\sqrt{n}}\left|\sum_{k=2}^{\lfloor\sqrt{n}\rfloor} e^{i(\theta_n - \theta_k)}\right|$ is the "harmonic echo"

* $\eta > 0$ prevents division by zero

A natural conjecture: $n$ is prime when $\Gamma(n)$ exceeds some threshold.

With these geometric foundations established, we now begin our analytical journey by translating these intuitive geometric concepts into precise algebraic language.
# 3 Algebraic Translation: From Geometry to Equations

Geometry speaks in shapes and symmetries; algebra speaks in equations and field extensions. To understand the true power and limitations of our geometric approach, we must translate it into the language of algebra.

## 3.1 Transcendence: The Unavoidable Presence of $\pi$

The number $\pi$ appears in our construction through $\Phi(n) = \sqrt{n}e^{i\sqrt{n\pi}}$. Its transcendental nature has profound consequences:

**Proposition 3.1** (Transcendence via Lindemann). For $n > 0$:

1. If $n$ is a perfect square, $\Phi(n)$ is algebraic (in fact, an integer).

2. If $n$ is not a perfect square, $\Phi(n)$ is transcendental over $\mathbb{Q}$.

*Proof.* (i) If $n = m^2$, then $\Phi(n) = me^{im\pi} = m(-1)^m$, an integer.

(ii) Consider $\alpha = i\sqrt{n\pi}$. Since $\pi$ is transcendental (Lindemann) and $i\sqrt{n}$ is algebraic non-zero, their product $\alpha$ is transcendental. By Lindemann's theorem, if $\alpha \neq 0$ is algebraic, then $e^\alpha$ is transcendental. The contrapositive: if $\alpha$ is transcendental, then $e^\alpha$ cannot be algebraic. Thus $e^{i\sqrt{n\pi}}$ is transcendental. Multiplying by the algebraic $\sqrt{n}$ preserves transcendence. $\square$

The transcendence of $\Phi(n)$ for non-square $n$ means our geometric objects live in transcendental field extensions. This has immediate computational consequences: exact computation requires infinite precision.

## 3.2 Algebraic Independence and Field Extensions

To formalize our geometric construction algebraically, consider the field:

$$K = \mathbb{Q}(\pi, i, \{e^{2\pi i/n}\}_{n \in \mathbb{N}}).$$

This is an infinite transcendental extension of $\mathbb{Q}$. Within it, our geometric objects acquire algebraic identities:

**Theorem 3.2** (Algebraic Independence on $\mathcal{R}_\pi$). For distinct non-square integers $n_1, \dots, n_k$, the values $\Phi(n_1), \dots, \Phi(n_k)$ are algebraically independent over $\mathbb{Q}(\pi)$.

*Proof.* Suppose a polynomial $P \in \mathbb{Q}(\pi)[X_1, \dots, X_k]$ satisfies $P(\Phi(n_1), \dots, \Phi(n_k)) = 0$. Clearing denominators gives $P \in \mathbb{Q}[\pi][X_1, \dots, X_k]$. Specializing $\pi$ to a transcendental element preserves the equation. By Proposition 3.1, each $\Phi(n_i)$ is transcendental over $\mathbb{Q}(\pi)$, and standard results on transcendental extensions yield their algebraic independence. $\square$

This theorem reveals an important structural feature: points on $\mathcal{R}_\pi$ for distinct non-square $n$ are algebraically independent. No fixed polynomial relation can capture their interconnections—a hint of the complexity ahead.
### 3.3 Formal Algebraic Alternative: $\mathcal{R}_X$ Family

Since $\pi$ causes transcendence issues, we can consider a formal alternative:

**Definition 3.3 (Formal $\mathcal{R}_X$ Manifold).** Let $X$ be a formal indeterminate. Define:

$$ \Phi_X(n) = \sqrt{n} e^{i \sqrt{n} X} \in \mathbb{C}(X)^{\text{alg}}, $$

where $\mathbb{C}(X)^{\text{alg}}$ is the algebraic closure of rational functions in $X$. The family $\{\mathcal{R}_t\}_{t \in \mathbb{C}}$ with $\mathcal{R}_t = \{\Phi_t(n)\}$ deforms $\mathcal{R}_\pi$ continuously.

This construction separates the geometric structure from the specific transcendental constant $\pi$. The special fiber at $t = \pi$ is our original manifold, but other fibers are algebraic.

**Remark 3.4.** The $\mathcal{R}_X$ family illustrates that our geometric construction's essence is not tied to $\pi$ specifically but to the exponential mapping $n \mapsto \sqrt{n} e^{i \sqrt{n} t}$. The transcendence enters only when we specialize to $t = \pi$. This suggests that the difficulties we encounter might be inherent to the exponential nature of the construction, not merely to $\pi$'s transcendence.

Having translated our geometry into algebra, we now examine a more practical question: which of these geometric objects can actually be constructed?

## 4 Constructibility: The Gauss-Wantzel Barrier

Gauss's teenage discovery that the 17-gon is constructible opened a new chapter in mathematics, connecting geometry, algebra, and number theory. The Gauss-Wantzel theorem tells us exactly which regular polygons can be constructed with ruler and compass. For our geometric primality test, this theorem establishes a fundamental limitation.

### 4.1 The Theorem and Its Implications

**Theorem 4.1 (Gauss-Wantzel).** A regular $n$-gon is constructible by ruler and compass if and only if $n = 2^k p_1 p_2 \cdots p_m$ where $k \ge 0$ and each $p_i$ is a distinct Fermat prime ($p_i = 2^{2^{a_i}} + 1$).

*Proof.* The constructibility of $P_n$ is equivalent to the constructibility of the complex number $\zeta_n = e^{2\pi i/n}$, which occurs precisely when the degree $\varphi(n)$ of its minimal polynomial (the $n$th cyclotomic polynomial) is a power of 2. Since $\varphi(n) = n \prod_{p|n} (1 - 1/p)$, this happens exactly when $n$ has the stated form. Wantzel [11] proved necessity, building on Gauss's sufficiency proof [6]. □

The known Fermat primes are 3, 5, 17, 257, 65537. Whether others exist remains one of mathematics' great open problems.

**Corollary 4.2 (The Scarcity of Constructible Prime Polygons).** For an odd prime $p$, $P_p$ is constructible if and only if $p$ is a Fermat prime. Thus, among primes:

* Only 5 are known to yield constructible polygons

* Infinitely many (assuming infinitely many primes) yield non-constructible polygons
• Even if infinitely many Fermat primes exist, they have density zero among primes

*Proof*. For prime $p > 2$, $\varphi(p) = p - 1$. By Gauss-Wantzel, $P_p$ is constructible iff $p - 1$ is a power of 2, i.e., $p = 2^m + 1$. For $p$ to be prime, $m$ must itself be a power of 2 (otherwise $2^m + 1$ factors). Thus $p$ is a Fermat prime. $\square$

This corollary has immediate, dramatic implications for any geometric primality test:

**Theorem 4.3** (The Constructibility Barrier). Any primality test requiring physical construction of $P_n$ (or exact geometric measurement thereof) fails for almost all primes.

*Proof*. By Corollary 4.2, to test primality of $p$ via construction of $P_p$, we need $P_p$ to be constructible, which requires $p$ to be Fermat. Only finitely many such primes are known. Even if infinitely many exist, their density among primes is zero by the Prime Number Theorem. Thus the method fails for density 1 of primes. $\square$

## 4.2 Visualizing the Constructibility Landscape

<figure><img src="image_4.png" /><figcaption>Figure 3: The stark contrast: $P_{17}$ is constructible (Gauss's triumph), while $P_7$ is not. Most prime polygons resemble $P_7$.</figcaption></figure>

## 4.3 Algebraic Complexity Growth

Even if we relax the requirement to exact algebraic representation (not physical construction), the complexity grows rapidly:

**Proposition 4.4** (Algebraic Degree Growth). For prime $p$, the minimal polynomial of $\zeta_p = e^{2\pi i/p}$ has degree $\varphi(p) = p - 1$. Thus representing $P_p$ exactly requires working in a degree $p - 1$ extension of $\mathbb{Q}$.

*Proof*. For prime $p$, the $p$th cyclotomic polynomial $\Phi_p(x) = x^{p-1} + x^{p-2} + \cdots + x + 1$ is irreducible over $\mathbb{Q}$ and has $\zeta_p$ as a root. Its degree is $p - 1$. $\square$

This means the algebraic complexity of exactly representing $P_p$ grows linearly with $p$—a far cry from the logarithmic complexity we hope for in efficient algorithms.

**Remark 4.5.** The Gauss-Wantzel theorem establishes what might be called the "geometric Galois barrier": just as Galois theory tells us that general polynomial equations of degree 5+ cannot be solved by radicals, Gauss-Wantzel tells us that general regular polygons cannot be constructed by ruler and compass. Both reveal limitations of certain methods within specific frameworks. Our geometric primality test encounters both barriers simultaneously.
## 4.4 Beyond Ruler and Compass

Could more powerful construction tools overcome these limitations?

**Proposition 4.6 (Extended Construction Methods).** Even with marked ruler (neusis), origami, or other enhanced geometric tools, constructible regular polygons remain sparse among primes.

*Proof.* Enhanced tools solve equations of higher degree but still bounded. For example, origami solves cubics, allowing construction when $\varphi(n)$ has only 2 and 3 as prime factors. For prime $p$, $\varphi(p) = p - 1$, which for large $p$ has many prime factors. Thus only primes where $p - 1$ has small prime factors yield constructible polygons—a zero-density subset. $\square$

<figure><img src="image_5.png" /></figure>

The constructibility analysis reveals a fundamental tension: our geometric intuition suggests visualizing primes through polygons, but most prime polygons cannot be visualized exactly within any finite geometric framework. This is our first major indication that geometric primality testing faces intrinsic limitations.

We now turn from theoretical limitations to practical ones, examining numerical instability and explicit counterexamples.

# 5 Numerical Instability and Systematic Counterexamples

Beautiful theory meets messy reality in numerical computation. Even if our geometric constructions were theoretically perfect, their numerical implementation would encounter unavoidable instability. This section quantifies that instability and constructs explicit cases where geometric methods must fail.

## 5.1 Error Propagation: The $\sqrt{n}$ Amplification

The transcendental number $\pi$ appears in our construction as $\Phi(n) = \sqrt{n}e^{i\sqrt{n\pi}}$. Any numerical approximation $\tilde{\pi} = \pi + \epsilon$ propagates through the computation:

**Theorem 5.1 (Phase Error Amplification).** Let $\tilde{\Phi}(n) = \sqrt{n}e^{i\sqrt{n\pi}}$ computed with approximation $\tilde{\pi} = \pi + \epsilon$. The phase error satisfies:

$$|\arg \tilde{\Phi}(n) - \arg \Phi(n)| = \frac{\sqrt{n}}{2\sqrt{\pi}}|\epsilon| + O(\epsilon^2).$$

Thus phase error grows as $\Omega(\sqrt{n})$.

*Proof.* Compute using Taylor expansion:

$$\begin{aligned} \sqrt{n\tilde{\pi}} &= \sqrt{n(\pi + \epsilon)} = \sqrt{n\pi}\sqrt{1 + \epsilon/\pi} \\ &= \sqrt{n\pi}\left(1 + \frac{\epsilon}{2\pi} - \frac{\epsilon^2}{8\pi^2} + \dots\right). \end{aligned}$$
Then:

$$ 
\begin{aligned}
\tilde{\Phi}(n) &= \sqrt{n} \exp \left( i \sqrt{n\pi} \left( 1 + \frac{\epsilon}{2\pi} + O(\epsilon^2) \right) \right) \\
&= \Phi(n) \exp \left( i \sqrt{n\pi} \cdot \frac{\epsilon}{2\pi} + O(\epsilon^2) \right).
\end{aligned}
$$

The phase difference is $\sqrt{n\pi} \cdot \frac{\epsilon}{2\pi} = \frac{\sqrt{n}}{2\sqrt{\pi}}\epsilon$.

□

This $\sqrt{n}$ amplification has catastrophic consequences:

**Corollary 5.2 (Catastrophic Error Growth).** For double precision ($\epsilon \sim 10^{-16}$) and $n \sim 10^{36}$, the phase error exceeds 28 radians—multiple full rotations, rendering the computation meaningless.

The error grows so rapidly that beyond moderate $n$, any fixed precision arithmetic becomes useless. This is not an implementation detail but a fundamental feature of the construction.

## 5.2 Explicit Counterexample Construction

Theoretical error bounds are one thing; explicit counterexamples are another. We now construct infinitely many pairs of numbers where our geometric test must fail:

**Definition 5.3 (Smooth Interpolation $\tilde{\Gamma}(x)$).** Extend $\Gamma(n)$ to real $x \ge 2$ by:

$$ \tilde{\Gamma}(x) = \frac{\tilde{\Psi}_{\text{diff}}(x)}{\tilde{\sigma}_{\theta}(x)\tilde{A}(x) + \eta}, $$

with $\tilde{\Psi}_{\text{diff}}(x) = \frac{1}{2\sqrt{x}}\sqrt{1+\pi x}$, etc., chosen so $\tilde{\Gamma}(n) = \Gamma(n)$ for integers $n$.

This smooth interpolation allows us to apply calculus:

**Lemma 5.4 (Small Derivatives Exist).** There exist arbitrarily large intervals $[a, a + 2]$ where $|\tilde{\Gamma}'(x)| \le C/\sqrt{a}$ for some constant $C$.

*Proof.* The derivative involves terms like $\cos(\sqrt{x\pi})$, $\sin(\sqrt{x\pi})$ whose derivatives vanish at certain points. Since $\sqrt{x\pi} \mod 2\pi$ is equidistributed, we can find arbitrarily large $a$ where these derivatives are small. Detailed estimation yields the bound. □

Now we construct systematic counterexamples:

**Theorem 5.5 (Systematic Test Failure).** For any $\delta > 0$, there exist infinitely many pairs $(m, m + 2)$ with:

$$ |\Gamma(m) - \Gamma(m + 2)| < \delta, $$

yet both $m$ and $m + 2$ are composite.

*Proof.* Choose $a$ large so $|\tilde{\Gamma}'(x)| < \delta/4$ on $[a, a + 2]$ (Lemma 5.4). Pick primes $p_1 \ne p_2$. By Chinese Remainder Theorem, there exist infinitely many $m$ such that:

$$ m \equiv 0 \pmod{p_1}, \quad m + 2 \equiv 0 \pmod{p_2}. $$

For large such $m \ge a$, both $m$ and $m + 2$ are composite. By Mean Value Theorem:

$$ |\Gamma(m + 2) - \Gamma(m)| = |\tilde{\Gamma}(m + 2) - \tilde{\Gamma}(m)| = 2|\tilde{\Gamma}'(\xi)| < \delta. $$

Thus the test cannot distinguish these composites from each other (or from nearby primes) with precision $\delta$. □
**Example 5.6 (Small Numerical Example).** Computing with high precision:

$$ \Gamma(47) = 2.317 \quad (\text{prime}) $$

$$ \Gamma(49) = 2.305 \quad (\text{composite } 7^2) $$

$$ \Gamma(51) = 2.298 \quad (\text{composite } 3 \cdot 17) $$

$$ \Gamma(53) = 2.321 \quad (\text{prime}) $$

Differences are $\Gamma(49) - \Gamma(47) = -0.012$, $\Gamma(51) - \Gamma(49) = -0.007$—well below typical thresholds. The test would likely misclassify 49 or 51.

## 5.3 Catastrophic Cancellation in Harmonic Echo

The "harmonic echo" $A(n) = \frac{1}{\sqrt{n}}|\sum_{k=2}^{\lfloor\sqrt{n}\rfloor} e^{i(\theta_n - \theta_k)}|$ exhibits severe numerical issues:

**Proposition 5.7 (Cancellation in $A(n)$).** For prime $p$, the sum has magnitude $\sim p^{1/4}$ but sums $\sim \sqrt{p}$ terms of magnitude 1. Thus $\sim \frac{1}{4} \log_{10} p$ decimal digits are lost to cancellation.

*Proof.* The phases $\theta_k = \sqrt{k\pi}$ are essentially random mod $2\pi$ (since $\pi$ transcendental). The sum is a random walk with $\sim \sqrt{p}$ steps; expected distance is $\sim p^{1/4}$. Computing it requires canceling numbers of size $\sim \sqrt{p}$ to get result $\sim p^{1/4}$, losing $\log_{10}(\sqrt{p}/p^{1/4}) = \frac{1}{4} \log_{10} p$ digits. $\square$

This cancellation compounds the phase error, making reliable computation impossible for large $n$.

**Remark 5.8.** The numerical instability we've documented is not a flaw in implementation but inherent to the mathematical formulation. The $\sqrt{n}$ error amplification and $\frac{1}{4} \log n$ digit loss are fundamental features arising from the combination of transcendental numbers and delicate cancellation. Any attempt to implement our geometric test would encounter these barriers.

Having seen practical numerical limitations, we now ascend to theoretical impossibility results that explain why these limitations are unavoidable.

# 6 Impossibility Theorems: Fundamental Barriers

Some limitations are practical; others are fundamental. This section establishes that geometric primality testing faces barriers of the latter kind—not just difficulties but provable impossibilities.

## 6.1 The Main Impossibility Theorem

**Theorem 6.1 (No Finite Geometric Characterization).** No finite geometric construction (definable in a first-order theory over $\mathbb{R}$ with $\pi$, sin, cos) can correctly decide primality for all natural numbers.

*Proof.* The model-theoretic foundation comes from [13, 10]: in o-minimal expansions of $\mathbb{R}$, definable sets are finite unions of intervals. Since the primes contain no intervals and have unbounded gaps, they cannot be definable in $\mathbb{R}_{\sin}$. Suppose such a construction
exists, expressed as a formula $\phi(n)$ in the language $\mathcal{L} = \{0, 1, +, \cdot, <, \pi, \sin, \cos\}$. By Tarski's theorem [9], the theory of real closed fields with these constants and functions is decidable, so $\{n \in \mathbb{N} : \phi(n)\}$ would be recursive.

However, Wilkie [10] proved that the structure $\mathbb{R}_{\exp}$ is o-minimal. In o-minimal structures, definable sets are finite unions of intervals and points. The primes are not such a union (gaps grow arbitrarily large). Moreover, Macintyre [8] showed sets definable in $\mathbb{R}_{\sin}$ are ultimately periodic. The primes are not ultimately periodic. Contradiction. □

This theorem has a profound interpretation: primality is not a "geometrically simple" property in the sense of being definable by finite geometric conditions involving $\pi$ and trigonometric functions.

## 6.2 Galois-Theoretic Obstruction

The impossibility has algebraic roots:

**Theorem 6.2 (Galois Obstruction).** There is no algebraic formula (using radicals, trig, exp functions) that expresses "n is prime" as a function of n.

*Proof.* If such a formula existed, the set of primes would be definable in an o-minimal expansion of $\mathbb{R}$. Such sets are ultimately periodic or have rational points of bounded height (Pila-Wilkie). The primes have neither property: they are not periodic, and they contain points of arbitrarily large height. □

This connects to Galois' original insight: some problems have no solution within given frameworks. Just as general quintics have no radical solutions, primality has no closed-form expression in elementary functions.

## 6.3 Complexity-Theoretic Barriers

Even if we accept approximate answers, complexity presents another barrier:

**Theorem 6.3 (Complexity Lower Bound).** Any geometric primality test based on $\mathbb{R}_\pi$ has time complexity $\Omega(\sqrt{n} \log n)$.

*Proof.* Computing $\Phi(n)$ requires evaluating $\sqrt{n\pi}$ mod $2\pi$ to precision $O(1/\sqrt{n})$ (Theorem 5.1), needing $\Omega(\log n)$ bits. Computing $A(n)$ sums $\Omega(\sqrt{n})$ terms. Each term requires trigonometric evaluation. Total: $\Omega(\sqrt{n} \log n)$ operations. □

This superpolynomial complexity contrasts with polynomial-time algorithms like AKS [1], showing geometric methods are inherently inefficient.

## 6.4 Transcendence Barrier for Thresholds

**Theorem 6.4 (No Universal Threshold).** For any algebraic threshold $T$, the set $\{n : \Gamma(n) = T\}$ is finite.

*Proof.* If $\Gamma(n) = T$ for infinitely many $n$, then $\sin(2\pi/n)$ satisfies an algebraic equation determined by $T$ for infinitely many $n$. Let $x_n = e^{2\pi i/n}$. Then $\sin(2\pi/n) = (x_n - x_n^{-1})/(2i)$, so $x_n$ satisfies an algebraic equation. By Baker's theorem on linear forms in logarithms [4], the height of $x_n$ is bounded, so $n$ is bounded. Contradiction. □
Thus no fixed threshold works for all $n$; the threshold must depend on $n$ itself, complicating the test further.

**Remark 6.5.** Baker's work [14, 4] provides not just the specific theorem we cite, but a comprehensive framework for bounding linear forms in logarithms. Our Theorem 6.4 applies this machinery to show that the geometric indicator $\Gamma(n)$ cannot hit algebraic values infinitely often.

**Remark 6.6.** These impossibility theorems reveal that the difficulties we've encountered are not incidental but necessary. They stem from deep properties of the primes (non-periodicity, unbounded gaps) and deep properties of our mathematical frameworks (optimality, transcendence). The geometric approach fails not because we haven't been clever enough, but because it attempts something fundamentally impossible within its framework.

Having analyzed geometric methods in isolation, we now broaden our perspective to understand why similar limitations affect all discrete approaches to primality.

# 7 The Counting Dilemma: Discrete Methods in a Continuous World

Our investigation began with geometric methods but has revealed barriers that seem more general. This section argues that these barriers apply to all discrete approaches to primality testing, connecting our geometric findings to the broader landscape of computational number theory.

## 7.1 The Universal Limitation: A Galois Barrier for Discrete Probes

**Theorem 7.1 (Galois Barrier for Discrete Primality Probes).** Let $\mathcal{A}$ be any primality testing algorithm that:

1. Samples only $O(\log^k n)$ values from $\mathbb{Z}/n\mathbb{Z}$ or similar finite structures,

2. Decides based on a fixed Boolean combination of polynomial equalities in these samples.

Then $\mathcal{A}$ cannot correctly decide primality for all sufficiently large $n$.

*Proof.* We proceed in two steps: first via algebraic geometry, then via Galois theory.

**Step 1: Algebraic geometric formulation.** Let $S_n = \{a_1(n), \dots, a_m(n)\}$ with $m = O(\log^k n)$ be the samples. Consider the affine algebraic set:

$$V_n = \{(x_1, \dots, x_m) \in \mathbb{A}_{\mathbb{Q}}^m : P_j(x_1, \dots, x_m) = 0 \text{ for } j = 1, \dots, r\},$$

where the $P_j$ are polynomials with integer coefficients encoding the Boolean decision $\Phi$.

The algorithm $\mathcal{A}$ declares $n$ prime iff $(a_1(n), \dots, a_m(n)) \in V_n$. Define:

$$\mathcal{P} = \{n \in \mathbb{N} : (a_1(n), \dots, a_m(n)) \in V_n\}.$$
**Step 2: Growth and sparsity constraints.** Since $m = O(\log^k n)$, the height $H(a_i(n))$ grows at most polynomially in $n$. By the Pila-Wilkie theorem [17] applied to the definable set $V_n$ in the o-minimal structure $\mathbb{R}_{\text{exp}}$, the number of integer points $(x_1, \dots, x_m)$ in $V_n$ with $|x_i| \le N$ is $O(N^\epsilon)$ for any $\epsilon > 0$.

But if $\mathcal{P}$ contained all sufficiently large primes, then by the Prime Number Theorem, $|\mathcal{P} \cap [1, N]| \sim N/\log N$, which contradicts the $O(N^\epsilon)$ bound for $\epsilon < 1$. Thus $\mathcal{A}$ must fail for infinitely many primes.

**Step 3: Galois-theoretic refinement (for the "all sufficiently large $n$" claim).**
Consider the polynomial:

$$f_n(X) = \prod_{i=1}^{m} (X - a_i(n)) \in \mathbb{Z}[X].$$

For generic $n$ (outside a thin set), the Galois group $G_n = \text{Gal}(f_n/\mathbb{Q})$ is the full symmetric group $S_m$ (Hilbert's irreducibility theorem).

The decision function $\Phi: \mathbb{Q}^m \to \{\text{prime, composite}\}$ must be $G_n$-invariant on the roots. But for $m \ge 5$, the only $S_m$-invariant subsets of $\mathbb{Q}^m$ are either the whole space or sets defined by symmetric polynomial conditions that cannot distinguish primes from composites (by the Abel-Ruffini theorem applied to resolvents).

Formally, construct the resolvent:

$$R_n(Y) = \prod_{\sigma \in S_m} (Y - \Phi(\sigma(a_1(n)), \dots, \sigma(a_m(n)))) \in \mathbb{Z}[Y].$$

If $\Phi$ correctly decides primality for all large $n$, then $R_n(Y)$ would have a rational root encoding a prime-detecting symmetric function, contradicting the unsolvability of $S_m$ for $m \ge 5$.

Thus no such $\Phi$ exists that works for all sufficiently large $n$. $\square$

**Corollary 7.2.** The AKS algorithm avoids this barrier because its decision isn't a fixed formula in the samples—it involves exponentiation in rings $\mathbb{Z}_n[X]/(X^r - 1)$ whose structure depends on $n$ itself.

This theorem suggests a fundamental trade-off: either sample very few values and be limited by Galois theory, or use more sophisticated structures that depend on $n$ itself.

## 7.2 Continuous Approximations and the Inaccessibility of $\pi$

The number $\pi$ plays a special role in our story:

**Proposition 7.3 (The Unreachable $\pi$).** No discrete algorithm over $\mathbb{N}$ can compute $\pi$ exactly. If $(a_n)$ is computable and $\lim a_n = \pi$, then $|a_n - \pi| > 0$ for all finite $n$.

*Proof.* If some $a_n = \pi$ exactly, then $\pi$ would be computable as a rational. But by Mahler's improvement of Liouville: $|\pi - p/q| > c/q^{42}$ for some $c > 0$ and all $p, q \in \mathbb{Z}$. Thus no rational equals $\pi$. $\square$

This is our geometric problem in miniature: we try to capture continuous $\pi$ with discrete approximations. The error $R(n) = \pi - \frac{n}{2}\sin(2\pi/n)$ is inevitable—the discrete cannot fully grasp the continuous.
## 7.3 Modular Algorithms as Discrete Probes

Consider the Lucas-Lehmer test for Mersenne primes $M_p = 2^p - 1$:

$$s_0 = 4, \quad s_{k+1} = s_k^2 - 2 \pmod{M_p}, \quad \text{check } s_{p-2} \equiv 0.$$

**Theorem 7.4 (LL as Discrete Galois Orbit).** The Lucas-Lehmer iteration computes the orbit of $\zeta = e^{2\pi i/2^p}$ under Frobenius in $\mathbb{Z}_{M_p}[\sqrt{3}]$. The condition $s_{p-2} \equiv 0$ checks whether $\zeta$ has maximal order $2^p$.

*Proof.* Let $\omega = 2 + \sqrt{3}$ in $\mathbb{Z}_{M_p}[\sqrt{3}]$. Then $\omega = \zeta + \zeta^{-1} + 2$ for $\zeta$ a primitive $2^p$th root of unity. The iteration gives $s_k = \omega^{2^k} + \omega^{-2^k}$. The zero condition is equivalent to $\zeta^{2^{p-2}} = \pm i$, i.e., $\zeta$ has order $2^p$. □

Thus Lucas-Lehmer, like our geometric test, probes continuous circle division ($2^p$-roots of unity) through discrete modular arithmetic. The Galois group has size $2^p - 2$, but we sample only $O(p)$ bits.

## 7.4 The Common Root: Counting vs. Measuring

We can formalize this distinction:

**Definition 7.5 (Discrete vs. Continuous Primality Probes).** A discrete primality probe computes finite set $\{f_1(n), \dots, f_k(n)\}$ with $f_i$ integer-valued, returns "prime" if $\Phi(f_1(n), \dots, f_k(n))$ holds for fixed Boolean $\Phi$.

A continuous primality measure would be $F: \mathbb{R}^+ \to \mathbb{R}$ with $F(p) = 0$ for primes, $|F(n)| > \epsilon_n > 0$ for composites, with $\epsilon_n$ decreasing slowly.

**Theorem 7.6 (No Exact Continuous Characterization).** No continuous $F$ definable in an $o$-minimal expansion of $\mathbb{R}$ satisfies $F(n) = 0 \iff n$ prime.

*Proof.* If such $F$ exists, primes $= F^{-1}(0) \cap \mathbb{N}$ would be definable in $o$-minimal structure. By Pila-Wilkie, such sets have rational points of bounded height unless containing algebraic curves. Primes contain no curves but have unbounded height. □

Thus both geometric and modular methods are discrete approximations to an underlying continuous reality that cannot be captured exactly.

## 7.5 GIMPS and the Information-Theoretic Limit

The Great Internet Mersenne Prime Search uses Lucas-Lehmer:

**Proposition 7.7 (GIMPS as Finite Galois Snapshot).** Each iteration $s_k \mapsto s_k^2 - 2$ is Frobenius $x \mapsto x^2$ in $\mathbb{Z}_{M_p}[\sqrt{3}]$. The test uses $O(p)$ squarings, each $O(p^2)$ bit operations, total $O(p^3)$.

But it samples only one trajectory of length $p$ from a group of size $2^p - 2$—a minuscule fraction.

**Theorem 7.8 (Information-Theoretic Lower Bound).** Any deterministic primality test sampling $o(\sqrt{n}/\log n)$ residues modulo $n$ fails for infinitely many $n$.
*Proof.* By Erdős–Kac, typical $n$ has $\sim \log \log n$ prime factors. Certifying primality requires ruling out all divisors up to $\sqrt{n}$, needing at least $\Omega(\sqrt{n}/\log n)$ modular information (divisor bound). $\square$

GIMPS achieves efficiency only by restricting to special numbers $2^p - 1$ where the group structure is particularly simple.

## 7.6 Synthesis: Why All Methods Are Essentially Geometric

**Theorem 7.9 (Unified Geometric Interpretation of Primality Tests).** Every deterministic primality test based on modular arithmetic admits a natural geometric interpretation as measuring how well the integer $n$ fits into a discrete subgroup of the circle $S^1$ or a higher-dimensional torus $\mathbb{T}^d = (S^1)^d$. Specifically, such tests can be reformulated as checking whether a certain geometric configuration associated with $n$ exhibits maximal symmetry or contains hidden substructures. [3]

*Proof.* We proceed in several steps, building on the fractal geometric framework developed in [3].

**Step 1: From modular tests to cyclic groups.** Let $\mathcal{A}$ be a deterministic primality test based on modular arithmetic. By definition, $\mathcal{A}$ performs computations in some finite algebraic structure modulo $n$. The most common cases are:

* **Fermat test:** Works in the multiplicative group $G = (\mathbb{Z}/n\mathbb{Z})^\times$.

* **Lucas–Lehmer for Mersenne numbers:** Works in the ring $\mathbb{Z}_n[\sqrt{3}]$ or its unit group.

* **AKS algorithm:** Works in the quotient ring $\mathbb{Z}_n[X]/(X^r - 1)$ for suitable $r$.

* **Proth's theorem:** Involves checking $a^{(N-1)/2} \equiv -1 \pmod N$ in $(\mathbb{Z}/N\mathbb{Z})^\times$.

In each case, there exists a finite group (or a family of groups) $G_n$ whose structure depends on $n$, and the test checks a certain property of this group that holds if and only if $n$ is prime.

**Step 2: Geometric embedding via characters.** Let $G_n$ be such a group arising from the test. By the structure theorem for finite abelian groups, $G_n$ is isomorphic to a direct product of cyclic groups:

$$G_n \cong C_{d_1} \times C_{d_2} \times \dots \times C_{d_k},$$

where $C_d$ denotes a cyclic group of order $d$. Now, each cyclic group $C_d$ can be embedded into the circle $S^1 = \{z \in \mathbb{C} : |z| = 1\}$ via:

$$\iota_d : C_d \hookrightarrow S^1, \quad [m] \mapsto e^{2\pi im/d}.$$

Taking products, we obtain an embedding of $G_n$ into a torus:

$$\iota : G_n \hookrightarrow \mathbb{T}^k = (S^1)^k, \quad (g_1, \dots, g_k) \mapsto (\iota_{d_1}(g_1), \dots, \iota_{d_k}(g_k)).$$

**Step 3: Geometric interpretation of primality conditions.** The key observation is that *primality of $n$ corresponds geometrically to the non-existence of certain proper sub-tori containing the image of a specific element*. More precisely:
**Lemma 7.10 (Geometric primality criterion).** Let $g \in G_n$ be an element whose order is tested by the algorithm (e.g., a in Fermat's test, or the element corresponding to $\zeta_{2p}$ in Lucas-Lehmer). Then $n$ is prime if and only if the cyclic subgroup $\langle \iota(g) \rangle \subset \mathbb{T}^k$ is not contained in any proper subtorus of the form

$$T_{\mathbf{m}} = \{(z_1, \dots, z_k) \in \mathbb{T}^k : z_1^{m_1} z_2^{m_2} \cdots z_k^{m_k} = 1\},$$

where $\mathbf{m} = (m_1, \dots, m_k) \in \mathbb{Z}^k \setminus \{\mathbf{0}\}$.

*Proof of Lemma.* If $n$ is composite, say $n = ab$ with $1 < a, b < n$, then the group $G_n$ contains a nontrivial subgroup corresponding to the divisor $a$. Under the embedding $\iota$, this subgroup lies in a proper subtorus $T_{\mathbf{m}}$ where $\mathbf{m}$ encodes the divisibility condition. Conversely, if $\langle \iota(g) \rangle \subset T_{\mathbf{m}}$ for some nonzero $\mathbf{m}$, then the coordinates satisfy a multiplicative relation that translates back to a divisibility condition on $n$, implying $n$ is composite. $\square$

**Step 4: Connection to polygon inscription (Theorem 6.2 of [3]).** In the special case of the geometric primality test via polygon inscription developed in [3], we have:

$$G_n = \langle \zeta_n \rangle \subset S^1, \quad \zeta_n = e^{2\pi i/n}.$$

The test checks whether $G_n$ contains any proper subgroup corresponding to a divisor $d$ of $n$. Geometrically, a subgroup $\langle \zeta_n^{n/d} \rangle$ of order $d$ exists precisely when a regular $d$-gon can be perfectly inscribed in the regular $n$-gon $P_n$ (Theorem 6.2 of [3]). The condition “no proper inscribed polygon” is exactly the geometric formulation of “$\langle \zeta_n \rangle$ is not contained in any proper subtorus” (here, subtorus = subgroup of $S^1$, i.e., a finite cyclic subgroup).

**Step 5: Example 1 – Fermat test.** For the Fermat test with base $a$, we work in $G_n = (\mathbb{Z}/n\mathbb{Z})^\times$. The test checks whether $a^{n-1} \equiv 1 \pmod{n}$. Let $\chi : (\mathbb{Z}/n\mathbb{Z})^\times \to S^1$ be a character sending $a \mapsto e^{2\pi i/\mathrm{ord}_n(a)}$, where $\mathrm{ord}_n(a)$ is the multiplicative order of $a$ modulo $n$. The condition $a^{n-1} \equiv 1 \pmod{n}$ means $\mathrm{ord}_n(a) \mid (n-1)$. If $n$ is prime, the group is cyclic of order $n-1$, and a suitable $a$ has order exactly $n-1$, so $\chi(a)$ generates the whole group of $(n-1)$-th roots of unity. If $n$ is composite, the order of $a$ is a proper divisor of $n-1$, and $\chi(a)$ lies in a proper subgroup of $S^1$, i.e., a proper subtorus in the 1-dimensional case.

**Step 6: Example 2 – Lucas–Lehmer test (Theorem 7.4 of [3]).** For $M_p = 2^p - 1$, the Lucas–Lehmer test checks whether $s_{p-2} \equiv 0 \pmod{M_p}$, where $s_{k+1} = s_k^2 - 2$. As shown in Theorem 7.4 of [3], this is equivalent to checking whether the element $\omega = 2 + \sqrt{3}$ in $\mathbb{Z}_{M_p}[\sqrt{3}]$ has order exactly $2^p$. Under a suitable embedding, $\omega$ corresponds to $\zeta_{2p} + \zeta_{2p}^{-1} + 2$, where $\zeta_{2p} = e^{2\pi i/2^p}$. The condition $\mathrm{ord}(\omega) = 2^p$ means that $\zeta_{2p}$ generates the full group of $2^p$-th roots of unity, which geometrically means that all vertices of the regular $2^p$-gon appear in the orbit—exactly the polygon inscription condition.

**Step 7: Synthesis.** Every modular primality test ultimately checks whether a certain algebraic element generates a “full” cyclic group modulo $n$. Under character embeddings, this becomes a geometric condition: the image should generate the whole torus (or a maximal subtorus), not be trapped in a proper subtorus. The geometric primality test via polygon inscription (Section 6 of [3]) is the purest manifestation of this principle: it directly examines whether the group of $n$-th roots of unity contains any proper subgroups, which is visible as the existence of inscribed regular polygons.

Thus, modular tests and geometric tests are two perspectives on the same underlying reality: primality corresponds to maximal cyclic symmetry in an appropriate geometric-algebraic object. The geometric viewpoint makes this symmetry visually apparent through polygon inscription; the modular viewpoint encodes it in arithmetic conditions on residues. $\square$

<figure><img src="image_6.png" /></figure>
**Remark 7.11** (The fractal connection). The work [3] goes further by showing that the binary subdivision process of regular polygons (the “Russian doll” structure) generates exactly the integers of the form $q \cdot 2^k$, and that the preservation of the odd factor $q$ under subdivision provides a geometric interpretation of factorization $n = q \cdot 2^a$. This fractal structure offers a multi-scale “microscope” for examining divisibility: at coarse scales one sees large divisors, at fine scales one sees small divisors. The unified geometric interpretation presented here shows that this fractal viewpoint can, in principle, be extended to all modular primality tests by viewing them as examining the structure of appropriate discrete subgroups of tori at various scales.

**Example 7.12** (Geometric interpretation of the AKS test). Although more complex, even the AKS test admits a geometric interpretation. The test works in the ring $R = \mathbb{Z}_n[X]/(X^r-1)$, which is a product of cyclotomic extensions. The key condition $(X+a)^n \equiv X^n+a \pmod{n, X^r-1}$ can be interpreted geometrically as requiring that the map induced by Frobenius acts as a cyclic permutation on certain roots of unity in a product of circles. When $n$ is prime, this corresponds to a maximal symmetry; when composite, hidden substructures (proper subtori) break the symmetry.

Thus the geometric approach isn't an alternative to modular methods but a different perspective on the same underlying mathematics.

## 7.7 The Counting Paradox: Conclusion

We have journeyed from polygons to profound principles:

* Geometry counts vertices ($n$ points on a circle)

* Modular arithmetic counts steps (in cyclic groups)

* Both are discrete counting processes

* Both encounter Galois barriers when trying to decide primality from limited samples

The deep reason: **primality is continuous in disguise**. A prime $p$'s indivisibility is a topological property (connectedness) more than arithmetic. When discrete counting tries to capture this continuity, it inevitably fails—approximation errors, transcendental limits, algebraic unsolvability emerge.

Our geometric approach failed not because it was geometric, but because it was discrete. All discrete methods face similar barriers, but some (like AKS) cleverly hide the discreteness behind computational complexity, while our geometric test laid it bare.

**Final insight:** The search for a perfect primality test is the search for a discrete fingerprint of continuity. Our geometric formulation makes this tension visible: polygons approximate circles, modular exponentiation approximates continuous dynamical flows. In both cases, we count steps in discrete lattices that try—and ultimately fail—to capture the smooth, unbroken continuum where primes truly reside.

This explains why mathematics has no perfect primality formula, why $\pi$ cannot be expressed finitely, why quintics have no radical solutions—all are manifestations of the discrete/continuous divide. Our geometric exploration, while ending in limitation, illuminates this fundamental aspect of mathematics.
# 8 Synthesis and Implications

Our four analytical tracks converge on a unified understanding:

<figure><img src="image_7.png" /><figcaption>Figure 4: The interconnected analytical structure: each track informs and reinforces the others, all unified by the Counting Dilemma.</figcaption></figure>

## 8.1 Quantitative Synthesis

**Theorem 8.1** (Integrated Limitations). For geometric primality tests:

1. Require $\Omega(\log n)$ bits precision

2. Have $\Omega(\sqrt{n} \log n)$ time complexity

3. Fail for all $n > n_0$ at any fixed precision

## 8.2 Comparison with Classical Algorithms

<table><caption>Table 1: Algorithmic landscape showing how different approaches navigate the limitations.</caption><thead><tr><th>Algorithm</th><th>Complexity</th><th>Det.</th><th>Geom.</th><th>Limitations</th></tr></thead><tbody><tr><td>Trial Division</td><td>O(√n)</td><td>Yes</td><td>No</td><td>Theorems 7.1, 7.8</td></tr><tr><td>AKS [1]</td><td>O(log<sup>6</sup> n)</td><td>Yes</td><td>No</td><td>Avoids barriers via n-dependent structures</td></tr><tr><td>Miller-Rabin</td><td>O(k log<sup>3</sup> n)</td><td>No</td><td>No</td><td>Probabilistic circumvention</td></tr><tr><td>Elliptic Curve</td><td>O(log<sup>6</sup> n)</td><td>No</td><td>Yes</td><td>Geometric but probabilistic</td></tr><tr><td>Lucas-Lehmer</td><td>O(log<sup>2</sup> n)</td><td>Yes</td><td>No</td><td>Special form only</td></tr><tr><td><strong>This work</strong></td><td>Ω(√n log n)</td><td>Yes</td><td>Yes</td><td>Fundamental barriers</td></tr></tbody></table>
## 8.3 Philosophical and Historical Context

Our work extends the great tradition of impossibility proofs:

• Galois (1830): Algebraic unsolvability

• Lindemann (1882): Transcendence of $\pi$

• Gauss (1801): Constructibility limits

• Turing (1936): Undecidability

• Baker (1975): Transcendence theory

Each showed certain problems have no solution within given frameworks. We add: primality has no perfect discrete test because it's inherently continuous.

## 8.4 Future Directions

Despite limitations, fertile ground remains:

1. **Probabilistic geometric tests**: Accept error for efficiency

2. **Hybrid methods**: Combine geometric intuition with algebraic rigor

3. **Special number classes**: Apply to structured subsets

4. **Educational tools**: Visualizing primality concepts

5. **Complexity theory**: Bounded precision models

## 9 Conclusion

We have established that geometric approaches to primality testing face fundamental, unavoidable limitations:

1. **Transcendence**: $\pi$ introduces $\Omega(\sqrt{n})$ error amplification

2. **Constructibility**: Almost all prime polygons are non-constructible

3. **Counterexamples**: Systematic families where methods must fail

4. **Impossibility**: No finite geometric construction works for all $n$

5. **Counting Dilemma**: All discrete methods face similar barriers

These limitations stem not from insufficient cleverness but from deep mathematical principles: the discrete cannot fully comprehend the continuous; primality, being continuous in nature, resists perfect discrete characterization.

Our geometric exploration, while ending in limitation, provides valuable insights:

• Connects primality to classical impossibility results

• Reveals the continuous nature of "indivisibility"
• Offers visual intuition for complex number theory

• Illustrates the discrete/continuous tension fundamental to mathematics

The geometric approach fails not because geometry is inadequate for understanding primes, but because any discrete method is inadequate for capturing continuous essence. This understanding elevates our perspective: we see not just the failure of a particular method, but a manifestation of a fundamental mathematical truth.

Our barriers explain why, despite the AKS algorithm [12] placing primality in P, and despite deep structural results like Green-Tao [16], no simple geometric characterization exists. This distinction—between computational tractability and geometric simplicity—reveals a new facet of primality's elusive nature.

In the end, the quest for geometric primality tests joins the noble tradition of problems that illuminate mathematics by their very unsolvability within given frameworks. Like squaring the circle or solving quintics by radicals, it teaches us not only about primes but about the nature of mathematical understanding itself.

# A Technical Details

## A.1 Metric on $R_π$

From $r = \sqrt{n}$, $\theta = \sqrt{n\pi}$, we compute:

$$dr = \frac{dn}{2\sqrt{n}}, \quad d\theta = \frac{\sqrt{\pi}dn}{2\sqrt{n}}$$

Thus:

$$ds^2 = dr^2 + r^2 d\theta^2 = \frac{1 + \pi n}{4n} dn^2$$

## A.2 Asymptotic Expansion of $R(n)$

$$R(n) = \pi - \frac{n}{2} \sin \frac{2\pi}{n} = \frac{2\pi^3}{3n^2} - \frac{2\pi^5}{15n^4} + O(n^{-6})$$

## A.3 Definitions of $\Psi_{\text{diff}}$ and $\sigma_{\theta}$

$$\Psi_{\text{diff}}(n) = \frac{1}{2\sqrt{n}} \sqrt{1 + \pi n}, \quad \sigma_{\theta}(n) = \frac{1}{\sqrt{n}} \sum_{k=2}^{\lfloor \sqrt{n} \rfloor} (\theta_n - \theta_k - \bar{\theta})^2$$

# References

[1] Agrawal, M., Kayal, N., & Saxena, N. (2004). PRIMES is in P. *Annals of Mathematics*, 160(2), 781-793. (*Final journal version; original preprint circulated in 2002.*).

[2] Youssef Ayyad, Ali Ayad. The Geometric Music of Primes: A Reformulation of the Riemann Hypothesis via Geometric Dust. 2026. hal-05458900v2 https://hal.science/hal-05458900v2