Learning Twin Primality from Pairs of Modular-Inverse Graphs
This work investigates whether twin-prime pairs can be identified from graph representations derived solely from modular-inverse relations. Each integer is represented as a graph in which vertices correspond to residues modulo that integer and edges encode multiplicative-inverse relations. We provide mathematical justification for two classification approaches: a Siamese Graph Isomorphism Network (SiameseGIN) and logistic regression. We identify the sum of the isolated-vertex proportions of the two graphs as a common structural quantity underlying both approaches and establish conditions under which it separates twin-prime pairs from non-twin pairs. For the SiameseGIN, we analyze the message-passing and pooling operations and show that the resulting graph representations encode the isolated-vertex proportions, allowing its decision score to depend on the same structural quantity. For logistic regression, we show that the decision score can be expressed as an affine function of this quantity and therefore admits perfect separation under these conditions. We further establish conditions under which the validation and test ranges admit a common separating threshold, providing a theoretical explanation for the empirical observation that the validation-selected threshold also achieves perfect separation on the test set. We evaluate both approaches experimentally using disjoint training, validation, and test ranges. A threshold selected exclusively on the validation set is applied unchanged to the test set, where both logistic regression and the SiameseGIN achieve a balanced accuracy of 1.000, with no false-positive or false-negative classifications. The principal contribution is a mathematical characterization of how the SiameseGIN architecture processes modular-inverse graphs, while the experimental results demonstrate agreement with the theoretical analysis.
Authors
- Tal Weissblat (ORCID: https://orcid.org/0009-0001-9160-6790)
Publication Details
- Journal
- Preprints.org
- Published
- 2026-11-02
- DOI
- https://doi.org/10.20944/preprints202611.0065.v1
- Primary Topic
- Analytic Number Theory Research
- Type
- preprint