Skip to content

Learning Primality from Modular-Inverse Graphs

Sep 2026 · Zenodo (CERN European Organization for Nuclear Research) · 5 references
Advanced Graph Neural Networks

Abstract

This work investigates whether graph neural networks (GNNs) can learn to distinguish prime from composite integers through graph-based representations of numbers. Each integer is represented by a modular-inverse graph whose structure is determined by multiplicative inverse relations modulo the integer. Importantly, the same graph-construction rule is applied to every integer, independently of whether it is prime or composite, and no primality label is explicitly incorporated into the graph representation. We provide a mathematical justification for the proposed approach by proving that, despite this uniform construction, systematic structural differences emerge between the modular-inverse graphs associated with prime and composite integers. In particular, prime integers produce graphs with the maximum possible number of edges connecting distinct nonzero vertices and no isolated nonzero vertices, whereas composite integers produce fewer such edges and contain isolated nonzero vertices. We further analyze the message-passing mechanisms of GraphSAGE and Graph Convolutional Networks (GCN), showing how these structural differences can be preserved or lost depending on the aggregation mechanism. Based on this mathematical characterization, GraphSAGE and GCN are comparatively evaluated on a dataset of 10,000 integers ranging from 2 to 10,001. Models trained on the modular-inverse graphs of smaller integers are evaluated on those of larger, previously unseen integers, with balanced accuracy (BA) used to account for the class imbalance between prime and composite numbers. The selected GraphSAGE architecture achieves a mean BA of 99.89% across three random seeds on the test set, whereas GCN remains at 50.00% validation BA across all evaluated configurations and seeds. These results align with the mathematical analysis and demonstrate that the ability to learn structural differences associated with primality from modular-inverse graphs depends critically on the GNN message-passing mechanism.

View source

Similar papers

#computer vision Conference Aug 2008

Scrum in a Multiproject Environment: An Ethnographically-Inspired Case Study on the Adoption Challenges

Agile methods continue to gain popularity. In particular, the Scrum method appears to be on the verge of becoming a de-facto standard in the industry, leading the so called Agile movement. While there are success stories and recommendations, there is little scientifically valid evidence of the challenges in the adoptio...

A. Marchenko, P. Abrahamsson · 59 citations · ⚡11
#computer vision Open access Sep 2012

Making the leap to a software platform strategy: Issues and challenges

A comprehensive taxonomy of the challenges faced when a medium-scale organization decided to adopt software platforms is provided, namely: business challenges, organizational challenges, technical challenges, and people challenges.

Yaser Ghanam, F. Maurer, P. Abrahamsson · 41 citations · ⚡3
#machine learning Open access Mar 2024

Integration of molecular coarse-grained model into geometric representation learning framework for protein-protein complex property prediction

MCGLPPI, a novel geometric representation learning framework that combines graph neural networks (GNNs) with the MARTINI molecular coarse-grained (CG) model to predict overall PPI properties accurately and efficiently, offers an effective and efficient solution for PPI overall property predictions.

Yang Yue, Shu Li, Yihua Cheng et al. · 15 citations
#data science Open access Oct 2026

Less can be more for predicting properties with large language models

Abstract Predicting properties from coordinate–category data—sets of vectors paired with categorical information—is fundamental to computational science, manifesting in materials science as predicting formation energies or elastic moduli from crystal structures. While large language models (LLMs) have increasingly been...

Nawaf Alampara, Santiago Miret, Kevin Maik Jablonka · 13 citations

PepPCBench is a Comprehensive Benchmarking Framework for Protein-Peptide Complex Structure Prediction

PepPCBench enables a robust evaluation of PFNN-based methods and supports their continued development for peptide-protein structure prediction, and highlights the influence of peptide length, conformational flexibility, and training set similarity on prediction accuracy.

Si-Long Zhai, Huifeng Zhao, Ji-Ke Wang et al. · 13 citations · ⚡1

Related blog posts

Microsoft Research Blog Jul 13, 2026

Verifying Rust cryptography in SymCrypt, from standards to code

Cryptographic code supports vital protections in modern computing systems. Learn how a new method helps verify code as developers write it while preserving speed and adaptability as it gets implemented and evolves. The post Verifying Rust cryptography in SymCrypt, from standards to code appeared first on Microsoft Research.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.