This project investigates prime factorisation and analytic number theory by expressing complex numbers as simultaneous pairs of real values. Treating the imaginary unit in this way lets us reason about complex arithmetic, visualise factor searches, and implement sieves while staying entirely within the real plane.
The repository now lives on a single branch and the documents referenced below are kept alongside the code. All of the links have been updated to use relative paths so they work both locally and on GitHub.
- Factors in the complex space introduces the simultaneous-real mapping and illustrates how trial division, Fermat's method, and complex trial multiplication interact on the complex lattice.
- The
Prime Factorizationdirectory gathers algorithms that combine these insights into practical routines. - The
Randjuliadirectories contain the code used to generate the visualisations and to prototype the factorisation methods.
The simultaneous representation of a complex value a + bi is defined as [(a - b), (a + b)]. A few examples:
| Complex number | Simultaneous real pair |
|---|---|
i |
[-1, 1] |
2i |
[-2, 2] |
-i |
[1, -1] |
8 + 5i |
[3, 13] |
-2 - 3i |
[1, -5] |
These pairs are the foundation for the geometric interpretations used throughout the project.
| Path | Description |
|---|---|
Complex space.md |
Narrative overview of the complex-space factor strip and how different algorithms traverse it. |
Prime Factorization/ |
Detailed write-ups for each factorisation method together with Julia source files. |
Prime Factorization/README.md |
Entry point for the factorisation notes shown below. |
R/ |
R scripts for generating the diagrams plus a gallery of their output. |
julia/ |
Julia implementations of the algorithms, including supporting utilities such as Newton_Square_Root.jl. |
Number Theory Papers/ |
Research papers that motivate the approach and provide mathematical background. |
Images/ |
Static images embedded throughout the documentation. |
The factorisation routines derived from the complex-space analysis are documented here:
Each note explains the intuition, provides worked examples, and links to the corresponding Julia implementation.
Unified Complex Space Factorization
combines every method above with the corrected Fermat terminal-digit sieve into one
deterministic O(N^(1/3)) routine, julia/complex_space_factorization.cpp:
g++ -std=c++17 -O3 -march=native julia/complex_space_factorization.cpp \
-lgmpxx -lgmp -pthread -o csf
./csf 3168987219233877513774136225800517
./csf --selftest # verifies the sieve tables and the factorization suiteTwo results from that work:
- The corrected terminal-digit sieve of
Complete_Fermat_Sieve_Verified.pdfis exactly the quadratic-residue sieve at modulus 20 —a^2 - Nmust be a square mod 20.--selftestverifies the two admissible sets agree for all ten odd residues mod 20. - Read that way the modulus is a free parameter, so the sieve generalises to a CRT wheel: ~420,000x reduction in candidates instead of the 5x that modulus 20 gives, and up to 396x end-to-end speedup on deep searches.
- Julia prototypes: The
julia/directory mirrors the documentation above. For example,julia/Simultaneous_Complex_Factorization.jlimplements the algorithm described in the accompanying markdown file. - R visualisations: R scripts such as
R/Complex Space Generator.Rreproduce the plots shown in the documentation. TheR/README.mdfile contains sample output and screenshots of the generated graphics.
Additional background, proofs, and derivations can be found in the Number Theory Papers collection. These papers formalise the simultaneous-real mapping, explore the resulting factor properties, and describe supporting sieves.