arXiv reader

Unconditional Primality Certificates for the Hexagonal 3-smooth Family p = 3m(m+1) + 1: Deterministic Pocklington Witnesses and Arithmetic Filters

Hassane Bakkaoui

arXiv
2606.18859v1 · PDF · 17 June 2026
Categories
math.GM
Licence
CC BY 4.0 The site shows the text.

Abstract

We study the parametric subfamily p = 3m(m+1) + 1 with m = 2^a 3^b - 1, a,b \in \mathbb{N}^*, a 3-smooth slice of the centred hexagonal numbers 3m^2 + 3m + 1 = (m+1)^3 - m^3, from the point of view of unconditional primality certification via the Pocklington-Lehmer criterion. The 3-smoothness of m+1 = 2^a 3^b yields, for every (a,b), a fully factored divisor F = 2^a 3^(b+1) of p-1 satisfying F > \sqrt(p) unconditionally, reducing the certificate to two witnesses, for q = 2 and q = 3. Our main new contribution is a complete, deterministic characterisation of the two canonical witnesses. We prove that w_2 = 5 is a valid witness if and only if a - b = 1, 2 (mod 4), by quadratic reciprocity; and that w_3 = 7 is a valid witness if and only if m is not congruent to 2 (mod 7), by cubic reciprocity in \mathbb{Z}[omega] using the explicit Eisenstein factorisation p = ((1+m) - m \omega)((1+m) - m \omega^2). These two results turn the heuristic "5 and 7 always work" (which is in fact false) into exact congruence conditions, and yield a deterministic witness-selection rule. Alongside, three elementary arithmetic filters (mod 6, a (-3) quadratic-residue sieve, and a mod-7 forbidden-class test) remove about 87% of candidates at negligible cost. As a demonstration, a multi-core implementation produced four unconditional certificates on consumer hardware, the largest a prime of 29998 decimal digits.

Items 29

Definition

Definition 2.1

34PE

For integers a,b\ge 1, set m(a,b)=2^{a}3^{b}-1 and p(a,b)=3m(m+1)+1=3m^2+3m+1. Its decimal digit count is D(a,b)=\lfloor 2a\log_{10}2+(2b+1)\log_{10}3\rfloor+1.

Lemma

Lemma 2.2 (Explicit factorisation)

X9N1

For p as in Definition 2.1,

p-1=2^{a}3^{b+1}\,m,\qquad F:=2^{a}3^{b+1}>\sqrt p.
Proof of Lemma 2.2

Since m+1=2^{a}3^{b}, p-1=3m(m+1)=3m\cdot 2^{a}3^{b}=2^{a}3^{b+1}m. As p=3m^2+3m+1<3(m+1)^2, we get \sqrt p<\sqrt3\,(m+1)<3(m+1)=2^{a}3^{b+1}=F.

Theorem

Theorem 2.3 (Pocklington–Lehmer certificate)

QJRW

Let p=p(a,b). Then p is prime iff there exist w_2,w_3 such that, for q\in\{2,3\},

w_q^{\,p-1}\equiv 1\pmod p,\qquad \gcd\!\bigl(w_q^{(p-1)/q}-1,\,p\bigr)=1.
Corollary

Corollary 2.4

XLFR

By Lemma 2.2, F>\sqrt p holds unconditionally and the only primes dividing F are 2,3; hence the certificate needs at most the two witnesses w_2,w_3.

Theorem

Theorem 3.1 (mod 6)

O8QR

For all a,b\ge1, p(a,b)\equiv1\pmod6.

Proof of Theorem 3.1

m=2^{a}3^{b}-1 is odd, so m(m+1) is even and p=3m(m+1)+1 is odd; and 3\mid 3m(m+1) gives p\equiv1\pmod3. By CRT, p\equiv1\pmod6.

Theorem

Theorem 3.2 ((-3)-sieve; quadratic reciprocity)

6QWF

Let m\in\mathbb{N}^{*}, p=3m(m+1)+1, and q\ge5 a prime with q\equiv2\pmod3. Then q\nmid p.

Proof of Theorem 3.2

q\mid p is equivalent to 3m^2+3m+1\equiv0\pmod q; completing the square, (6m+3)^2\equiv-3\pmod q, so -3 must be a quadratic residue mod q. By quadratic reciprocity [IR], \left(\frac{-3}{q}\right)=+1 iff q\equiv1\pmod3. For q\equiv2\pmod3 there is no solution, so q\nmid p.

Corollary

Corollary 3.3

V3ZL

In trial division up to L, only primes q\equiv1\pmod3 need be tested, i.e. half of the primes in [5,L] by Dirichlet.

Theorem

Theorem 3.4 (Forbidden classes mod 7)

ULNI

Let m=2^{a}3^{b}-1. With \mathcal F_7=\{(0,2),(0,3),(1,0),(1,1),(2,4),(2,5)\}\subset \mathbb{Z}/3\times\mathbb{Z}/6,

7\mid p(a,b)\iff (a\bmod3,\,b\bmod6)\in\mathcal F_7 ,

exactly 1/3 of all residue classes.

Used by Proof
Proof of Theorem 3.4

Since \mathrm{ord}_7(2)=3 and \mathrm{ord}_7(3)=6, t:=2^{a}3^{b}\bmod7 depends only on (a\bmod3,b\bmod6), and m\equiv t-1, p\equiv3t^2-3t+1\pmod7. Multiplying 7\mid p by 5\equiv3^{-1} gives t^2-t-2\equiv0, i.e. (t-2)(t+1)\equiv0, so t\in\{2,6\}. Enumerating the 18 values of t (Table ?) yields exactly \mathcal F_7.

Remark

Remark 3.5 (Combined efficiency)

9V87

The mod-6 identity is automatic. The two a-priori filters (Corollary 3.3 and Theorem 3.4) together remove \approx 87\% of candidates before any large-number arithmetic; see Table ?.

Theorem

Theorem 4.1 (w_2=5; rigorous)

FG2I

For p=p(a,b) prime, w_2=5 is a valid Pocklington witness if and only if

m\equiv 1\text{ or }3\pmod5 \qquad\Longleftrightarrow\qquad a-b\equiv 1\text{ or }2\pmod4 .
Proof of Theorem 4.1

By (?), w_2=5 is valid iff \left(\frac{5}{p}\right)=-1. As 5\equiv1\pmod4, quadratic reciprocity gives \left(\frac{5}{p}\right)=\left(\frac{p}{5}\right), and \left(\frac{p}{5}\right)=-1 iff p\equiv2,3\pmod5. Modulo 5, p=3m(m+1)+1 takes the values 1,2,4,2,1 for m\equiv0,1,2,3,4; hence p\equiv2,3\pmod5 (the value 3 never occurs) iff m\equiv1,3\pmod5. Finally m+1=2^{a}3^{b} and 3\equiv2^{3}\pmod5 give m+1\equiv2^{\,a+3b}\pmod5 with \mathrm{ord}_5(2)=4, so m\equiv1\iff a+3b\equiv1 and m\equiv3\iff a+3b\equiv2\pmod4. Since a+3b\equiv a-b\pmod4, the claim follows.

Remark

Remark 4.2

50T3

For a-b\equiv0,3\pmod4, 5 is a quadratic residue and w_2=5 fails; the least quadratic non-residue is then a valid witness.

Lemma

Lemma 4.3

L7QA

Let \omega=e^{2\pi i/3}. Then in \mathbb{Z}[\omega],

p=(m+1)^3-m^3=\pi\,\overline\pi,\qquad \pi:=(1+m)-m\omega,\qquad N(\pi)=p,

so \pi is a prime of \mathbb{Z}[\omega] above p. Consequently 7 is a cubic residue mod p iff \left(\frac{7}{\pi}\right)_{\!3}=1, where \left(\frac{\cdot}{\pi}\right)_{\!3} is the cubic residue symbol.

Proof of Lemma 4.3

3m^2+3m+1=(m+1)^3-m^3 (centred hexagonal identity). With X^3-Y^3=(X-Y)(X-\omega Y)(X-\omega^2Y), X=m+1, Y=m: p=\bigl((1+m)-\omega m\bigr)\bigl((1+m)-\omega^2 m\bigr). A direct computation gives N(\pi)=(1+m)^2-(1+m)(-m)+m^2=1+3m+3m^2=p; since p\equiv1\pmod3 is prime it splits into two conjugate primes of norm p, and \pi is one of them.

Proposition

Proposition 4.4 (Cubic character of 7)

C7FU

Let p=3m^2+3m+1 be prime, p\neq7, with m\equiv2\pmod3. Then

7\text{ is a cubic residue mod }p\iff m\equiv 2\text{ or }6\pmod7 .
Used by Proof, Proof
Proof of Proposition 4.4

Factor 7=\lambda\overline\lambda with \lambda=3+\omega, \overline\lambda=2-\omega (N(\lambda)=7). Their primary associates (those \equiv2\bmod3) are \lambda^{*}=2+3\omega=-\omega^2\lambda and \overline\lambda^{*}=-1-3\omega=-\omega\,\overline\lambda, equivalently \lambda=-\omega\,\lambda^{*} and \overline\lambda=-\omega^2\,\overline\lambda^{*}. Since m\equiv2\pmod3, the primary associate of \pi=(1+m)-m\omega is

\pi^{*}=-\omega^{2}\pi=(1+2m)+(1+m)\omega \qquad(1+2m\equiv2,\ 1+m\equiv0\bmod3).

The cubic symbol depends only on the prime ideal in its lower entry, so \left(\frac{7}{\pi}\right)_{\!3}=\left(\frac{7}{\pi^{*}}\right)_{\!3}. By multiplicativity and \left(\frac{-1}{\cdot}\right)_{\!3}=1,

\left(\frac{7}{\pi^{*}}\right)_{\!3} =\left(\frac{\omega}{\pi^{*}}\right)_{\!3}\left(\frac{\lambda^{*}}{\pi^{*}}\right)_{\!3}\cdot \left(\frac{\omega^2}{\pi^{*}}\right)_{\!3}\left(\frac{\overline\lambda^{*}}{\pi^{*}}\right)_{\!3},

and \left(\frac{\omega}{\pi^{*}}\right)_{\!3}\left(\frac{\omega^2}{\pi^{*}}\right)_{\!3}=\left(\frac{\omega^3}{\pi^{*}}\right)_{\!3}=1: the units cancel. Eisenstein’s law of cubic reciprocity [IR, Ch. 9], applied to the primary primes \lambda^{*},\overline\lambda^{*},\pi^{*}, gives \left(\frac{\lambda^{*}}{\pi^{*}}\right)_{\!3}=\left(\frac{\pi^{*}}{\lambda^{*}}\right)_{\!3} and similarly for \overline\lambda^{*}, so

\left(\frac{7}{\pi}\right)_{\!3}=\left(\frac{\pi^{*}}{\lambda^{*}}\right)_{\!3}\cdot\left(\frac{\pi^{*}}{\overline\lambda^{*}}\right)_{\!3}.

We evaluate in \mathbb{Z}[\omega]/(\lambda^{*})\cong\mathbb{F}_7 and \mathbb{Z}[\omega]/(\overline\lambda^{*})\cong\mathbb{F}_7. From \lambda^{*}=2+3\omega\equiv0 we get \omega\equiv4\pmod7 (and \omega^2\equiv2); from \overline\lambda^{*}=-1-3\omega\equiv0, \omega\equiv2 (and \omega^2\equiv4). Hence

\pi^{*}\equiv(1+2m)+4(1+m)=5-m \ (\mathrm{mod}\ \lambda^{*}),\qquad \pi^{*}\equiv(1+2m)+2(1+m)=3+4m \ (\mathrm{mod}\ \overline\lambda^{*}).

Since \left(\frac{\alpha}{\theta}\right)_{\!3}\equiv\alpha^{(N(\theta)-1)/3}=\alpha^{2}\pmod\theta for N(\theta)=7, we have \left(\frac{\pi^{*}}{\lambda^{*}}\right)_{\!3}\equiv(5-m)^2 and \left(\frac{\pi^{*}}{\overline\lambda^{*}}\right)_{\!3}\equiv(3+4m)^2 in \mathbb{F}_7, each lying in the cube-roots subgroup \{1,2,4\}=\{1,\omega,\omega^2\} under the identifications above (\omega\mapsto4 resp. \omega\mapsto2). Multiplying in \{1,\omega,\omega^2\}, the product equals 1 exactly for m\equiv2,6\pmod7; this is the finite verification of Table ?. (The omitted classes m\equiv1,5\pmod7 give 5-m\equiv0 or 3+4m\equiv0, i.e. 7\mid p.)

Theorem

Theorem 4.5 (w_3=7; rigorous)

R8ZH

For p=p(a,b) prime, w_3=7 is a valid Pocklington witness if and only if

m\not\equiv2\pmod7 \qquad\Longleftrightarrow\qquad (a\bmod3,b\bmod6)\notin\{(0,1),(1,5),(2,3)\}.
Proof of Theorem 4.5

If p=7 then m=1 and \pi is associate to \lambda, so w_3=7 does not apply; discard this case. For p>7: since b\ge1, 3\mid3^b, so m+1\equiv0\pmod3, i.e. m\equiv2\pmod3; and m+1=2^{a}3^{b} is coprime to 7, so m\not\equiv6\pmod7; finally m\equiv1,5\pmod7 give 7\mid p (Theorem 3.4), excluded. Thus m\bmod7\in\{0,2,3,4\} and Proposition 4.4 applies: 7 is a cubic residue iff m\equiv2 or 6\pmod7, hence (as m\not\equiv6) iff m\equiv2\pmod7. By (?), w_3=7 is valid iff 7 is a cubic non-residue, i.e. m\not\equiv2\pmod7. The translation to (a\bmod3,b\bmod6) follows from m\equiv2\pmod7\iff m+1\equiv3\pmod7, whose solutions in Table ? are \{(0,1),(1,5),(2,3)\}.

Remark

Remark 4.6 (Role of 3-smoothness)

N4D7

Proposition 4.4 distinguishes two residue classes (m\equiv2,6) and holds for any m\equiv2\pmod3. It is the 3-smoothness m+1=2^{a}3^{b} that both forces m\equiv2\pmod3 (fixing the primary normalisation of \pi) and excludes m\equiv6\pmod7, collapsing the criterion to the single congruence m\equiv2\pmod7. Without smoothness, cubic residuosity of 7 depends on m\bmod21 (Proposition 4.7), not m\bmod7 alone.

Proposition

Proposition 4.7 (Cubic character of 7, general family)

M948

Let p=3m^2+3m+1 be prime, p\neq7. Then 7 is a cubic residue modulo p if and only if

m\equiv 0,\,2,\,10,\,18,\ \text{or}\ 20 \pmod{21},

equivalently, according to m\bmod3, if and only if the condition of Table ? holds. Exactly 5 of the 15 admissible classes modulo 21 are cubic-residue classes.

Proof of Proposition 4.7

As in Proposition 4.4, the primary associate of \pi=(1+m)-m\omega is \pi^{*}=u\pi, where u=-1,-\omega,-\omega^2 according as m\equiv0,1,2\pmod3 — the unique unit making the leading coefficient \equiv2\pmod3. In every case the unit factors cancel in \left(\frac{7}{\pi}\right)_{\!3}=\left(\frac{\pi^{*}}{\lambda^{*}}\right)_{\!3}\left(\frac{\pi^{*}}{\overline\lambda^{*}}\right)_{\!3} (the argument of Proposition 4.4 uses only \left(\frac{-1}{\cdot}\right)_{\!3}=1 and \left(\frac{\omega}{\cdot}\right)_{\!3}\left(\frac{\omega^2}{\cdot}\right)_{\!3}=1, which hold for any associate). Reducing \pi^{*} modulo \lambda^{*} and \overline\lambda^{*} gives the linear forms of Table ?; squaring (the exponent (7-1)/3=2) and combining in \{1,\omega,\omega^2\} yields \left(\frac{7}{\pi}\right)_{\!3}=1 exactly on the listed classes. A direct check confirms 0 exceptions over all 1797 such primes with m<9000 (Appendix).

Remark

Remark 4.8

P74O

In the present 3-smooth subfamily one has m\equiv2\pmod3 and m\not\equiv6\pmod7 (by 3-smoothness), so only the class m\equiv2\pmod7 survives, recovering Theorem 4.5.

Corollary

Corollary 4.9

OTII

The fixed pair (w_2,w_3)=(5,7) is not valid for all primes of the subfamily; its validity is the conjunction a-b\equiv1,2\pmod4 and m\not\equiv2\pmod7. A correct witness choice is determined by the residue class of (a,b):

w_2=\begin{cases}5,& a-b\equiv1,2\ (4),\\ \text{least quadratic non-residue},&\text{else;}\end{cases}\qquad w_3=\begin{cases}7,& m\not\equiv2\ (7),\\ \text{least cubic non-residue},& m\equiv2\ (7).\end{cases}

In the case m\equiv2\pmod7 a cubic non-residue is found deterministically by testing small primes: cubic non-residues form two-thirds of (\mathbb{Z}/p\mathbb{Z})^{*}, so one is reached after a bounded search. Hence the certificate search is provably correct, rather than reliant on fixed witnesses succeeding by chance.

Remark

Remark 5.1 (MR round reduction)

1C1J

Miller–Rabin is deterministic for primes (every prime passes every round); reducing the initial round count carries zero risk of discarding a true prime, and rare composites are removed by confirmation rounds and by Pocklington.

Remark

Remark 6.1

QQ0P

The sieve fraction (53.8\% above) depends on the trial-division bound L: a larger L removes more composites before Miller–Rabin. The figure \approx87\% for the two a-priori filters is therefore relative to the L used in this run, not an absolute constant. The mod-7 fraction (33.3\%, Theorem 3.4) is exact and L-independent.

Source and licence

The text on this page is from arXiv:2606.18859v1 by Hassane Bakkaoui, under the licence CC BY 4.0. The corpus made these changes: it read the items out of the LaTeX source, it expanded the macros of the paper, it put each proof after its statement, and it converted the text to HTML. The formulas are the TeX of the paper, and KaTeX renders them. A formula or a reference can look different from the PDF. The page is published under CC BY 4.0.

The record of each item is in analysis/objects/2606/2606.18859.jsonl.