The Miller–Rabin test asks whether a random unit modulo behaves as it would if were prime. The cubic Frobenius test asks the same question in a rank-three algebra. Its prime-case identity is , where a cubic residue calculation selects one of two nonidentity conjugations.
This overview explains the test, the determinant-norm unit screen, an exact product formula for squarefree inputs, and the bound when is a product of two distinct odd primes. It also reports what large computations do—and do not—suggest beyond the proved semiprime case. The work is preliminary and has not been peer reviewed.
Four ways into the story
| Reader | Main point |
|---|---|
| Algebraist | A finite tale cubic algebra over , its determinant norm, and an explicit order-three automorphism. |
| Number theorist | A cubic residue symbol selects Frobenius; local splitting data and gcds determine every unit-liar count. |
| Probabilist | One round has an exact error probability , conditional on a uniformly sampled unit. |
| Algorithm designer | Arithmetic is three-coordinate modular arithmetic plus exponentiation and gcd; a public reference implementation is available. |
I use abf as a short project label, not as a claim that the name has become standard. The descriptive name is the cubic Frobenius unit test.
From Fermat liars to algebra liars
For an odd integer , the Fermat congruence
holds for every unit when is prime. A composite may nevertheless pass for some choices of ; these are the Fermat liars. Miller–Rabin strengthens the congruence and has a celebrated uniform bound: at most one quarter of the eligible bases are strong liars for any odd composite [Rabin; Monier].
Frobenius tests replace the scalar ring by a polynomial quotient algebra and replace the identity map by a Frobenius conjugation. This idea has a substantial history, including Atkin’s normal cubics and Grantham’s general framework for Frobenius pseudoprimes [Atkin; Grantham]. The present construction fixes a particularly explicit cyclic cubic family and randomizes the element of the algebra, rather than the polynomial.
The central question is therefore familiar:
For a fixed composite , what proportion of random algebra units imitate the prime-case Frobenius identity?
An exact answer is more informative than an isolated experiment. It reveals which arithmetic coincidences make an input deceptive and where a uniform bound could be sharp.
The cubic algebra and its conjugations
Choose a prime
so that . The first possibilities are . Put
and let . Since is monic, every element has a unique form
When is composite, is generally not a field. It is an algebra over the commutative ring , and a free module of rank three. That distinction is useful rather than troublesome: the Chinese remainder theorem lets us read the algebra one prime factor of at a time.
The discriminant
is a square. Consequently, away from primes dividing , the reduction of is either irreducible or splits completely; the linear-times-quadratic pattern does not occur. Moreover, the other two roots are explicit quadratic polynomials in . For example,
Substitution defines a -algebra automorphism of order three, with . Thus there are two nonidentity conjugations, and , and a prime input must tell us which one is its Frobenius.
Which conjugation does a prime obey?
Set . The cubic character
takes values among the three cube roots of unity modulo :
Call admissible for when
The explicit Frobenius-selection theorem says that, for prime , selects , while selects [Bernier, companion manuscript]. Write the selected map as . Then every prime input satisfies
The extension from to an arbitrary element is elementary, but worth writing out. Every element of has a unique expression
Because is prime here, the coefficients satisfy , , and . The freshman’s dream and the identity therefore give
In the penultimate line we used the fact that is an -algebra automorphism: it fixes the coefficients and preserves addition and multiplication. Thus, once the correct image of the single generator is known, the identity follows for every element of the algebra. For composite , exponentiation by is still a homomorphism on the multiplicative unit group, but it is not generally a ring homomorphism. Equation (1) can then hold only accidentally.
One randomized unit round
Why sample only units? Because the passing elements then form a subgroup. Multiplication by is a linear endomorphism of the free rank-three module. Define
The adjugate identity gives the clean criterion
Thus a round is concrete:
Choose an admissible (the computations below use the least one) and determine .
Choose uniformly modulo and put .
Compute . If , a factor has been found. If , discard and resample. If , the retained element is uniform in .
Compute and . A mismatch proves that is composite; a match passes this round.
The unit liars are
Because is abelian, is the kernel of . Its relative size
is exactly the error probability of one uniformly sampled unit round. Repeating independent rounds raises this probability to the corresponding power.
The arithmetic cost is multiplications in a three-dimensional algebra, plus small-parameter work and gcds. This is a larger constant than one Miller–Rabin round. The point of the present work is therefore not a premature claim of practical superiority, but a structural and quantitative analysis of a new randomized parameter space.
The exact squarefree formula
Suppose is squarefree. At each prime , the local algebra is one of
Call the cases split and inert. At an inert prime, the selected conjugation restricts to for a unique . The exact formula is
The proof is a compact local calculation. The Chinese remainder theorem decomposes into its prime components. In the inert case, is cyclic and the local equation is , giving the second gcd. In the split case, cyclically permutes three copies of ; three linked equations reduce to , giving the first gcd. Multiplying the local counts proves the displayed product formula.
This is the cubic analogue of what makes Monier’s formula so useful for Miller–Rabin: the probability is no longer a black box. It is a finite product whose unusually large factors can be studied one at a time.
The star witness: squarefree semiprimes
The cleanest theorem occurs when with odd primes.
Theorem 1 (Squarefree semiprime bound [Bernier, 2026]). For every prime admissible for ,
Thus one cubic unit round rejects a squarefree semiprime with probability greater than . The statement is uniform in the admissible parameter , not merely valid for the least choice used in experiments.
This is not dimension counting. Although has about elements, the two local kernels can be enlarged by common divisors coming from cross-prime congruences. The theorem is a gcd-clash statement: the two primes cannot simultaneously donate enough local resonance to reach the boundary.
The exponent is conditionally sharp. If admissible primes satisfy
then along any unbounded such family. No infinitude is claimed; simultaneous primality here is a Bateman–Horn type problem. The small instance
already gives
The comparison with Miller–Rabin should be read correctly. The classical bound applies to every odd composite and comes with decades of implementation experience. The bound is far smaller but presently proved only for squarefree semiprimes, and a cubic round is more expensive. The mathematical novelty is the decaying, essentially sharp bound in this specific family.
What the computations say
For a consistent census, let be the least admissible prime , and write
Then , so a smaller means a more deceptive composite. The semiprime theorem says for every squarefree semiprime and every admissible .
An exhaustive exact-formula census of all odd squarefree composites through found a smaller value once more prime factors were allowed:
Figure 1 shows the full distribution. The bulk is far to the right of the displayed record; the logarithmic vertical axis is essential. This computation is evidence, not a theorem. In particular, it does not prove , even for squarefree .
Separate exact computations on Carmichael numbers through are also informative because Carmichael numbers inherit all the divisibility supplied by Korselt’s criterion. The smallest observed exponent in that census was
This suggests that the difficult cases are structured rather than random. It does not rule out a future example below , and it does not replace a proof.
What remains open
The exact formula turns broad questions into arithmetic ones.
Can a composite fool every unit? The extreme event would be a cubic analogue of Carmichael behavior for this selected Frobenius congruence. No example is known.
Can ? Equivalently, can ? Current data show a substantial margin but no general theorem.
What happens at fixed ? The semiprime case is understood sharply. Even a positive asymptotic lower bound for at each fixed number of prime factors would be meaningful progress.
What changes at prime powers? Squarefreeness turns into a product of finite fields. Nonsquarefree inputs introduce congruence subgroups and a genuine lifting problem in finite local rings.
Where does the test belong computationally? A useful implementation should be benchmarked inside a conservative pipeline, alongside established tests, with reproducible random sampling and adversarial test sets. The mathematics does not yet justify replacing Miller–Rabin or Baillie–PSW.
To me, the conceptual question is broader than one algorithm:
How much finite-field structure can a composite modulus imitate before arithmetic compatibility forces the imitation to collapse?
The cubic algebra makes that question concrete. Its units can be sampled, its liars form a group, and—in the squarefree case—their proportion can be written down exactly.
Code, paper, and status
The preprint, companion manuscript, and source archive are available at Zenodo record 21705261. A single-threaded C/GMP reference implementation and an exact-guided tally demonstration are at github.com/mariotrevi/cubic-frobenius-unit-test.
This is a preliminary research project. The public implementation is a readable reference, not a certified cryptographic library. AI systems used under the names Fable, ChatGPT, and Kimi K3 contributed substantially to discussion, exposition, code review, and cross-checking. The author revised the material and takes responsibility for the statements and computations presented here.
References
A. O. L. Atkin, Intelligent primality test offer, in Computational Perspectives on Number Theory, AMS/IP Studies in Advanced Mathematics 7 (1998), 1–11.
D. Bernier, Unit Liars in a Cubic Frobenius Test: An Exact Formula and an Semiprime Bound, v0.3.1, 2026. Zenodo record 21705261.
D. Bernier, Which root does Frobenius pick? An explicit rule for , proved from scratch, companion manuscript, 2026.
A. Fiori and A. Shallue, Average liar count for degree-2 Frobenius pseudoprimes, Math. Comp. 89 (2020), 493–514.
J. Grantham, Frobenius pseudoprimes, Math. Comp. 70 (2001), 873–891.
P. Laurent and P. Underwood, A Cubic Composite Test, arXiv:2505.02167, 2025.
L. Monier, Evaluation and comparison of two efficient probabilistic primality testing algorithms, Theoret. Comput. Sci. 12 (1980), 97–108.
M. O. Rabin, Probabilistic algorithm for testing primality, J. Number Theory 12 (1980), 128–138.


Post Scriptum: There is an interactive demo of this cubic test at: https://cubicfrobenius.ca/.