Utilizando técnicas de aprendizado de máquina para identificar números primos
Loading...
Date
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
Universidade Federal de Viçosa
Abstract
Este trabalho investiga a aplicabilidade de técnicas de aprendizado de máquina na identificação e modelagem de números primos. Foram empregados os algoritmos KNN, Random Forest, XGBoost e MLP em duas tarefas supervisionadas: regressão, para prever o valor de um primo a partir de sua posição, intervalo e classe módulo 4; e classificação, para distinguir números primos de compostos utilizando o valor numérico e a função aritmética Ω(n). Os modelos foram avaliados sobre uma base inicial de 999.999 primos. Nos experimentos de regressão, apenas o MLP obteve desempenho satisfatório (R2 = 0, 96; MAPE = 1, 58%), enquanto os demais algoritmos apresentaram R2 negativos. Na classificação, o uso de Ω(n) como variável preditora resultou em acurácia perfeita para a maioria dos algoritmos, tornando o problema trivial. Sem Ω(n), todos os modelos limitaram-se a prever a classe majoritária (composto), obtendo altas acurácias devido ao forte desbalanceamento entre as classes, mas sem conseguir identificar nenhum número primo (sensibilidade zero). Os resultados indicam que o valor numérico isolado não contém informação suficiente para a classificação, e que a engenharia de atributos é determinante para o sucesso da abordagem. Palavras-chave: Aprendizado de Máquina; Números Primos; Classificação; Regressão; Função Ômega.
This work investigates the applicability of machine learning techniques for identifying and modeling prime numbers. The KNN, Random Forest, XGBoost, and MLP algorithms were employed in two supervised tasks: regression, to predict the value of a prime based on its rank, interval, and equivalence class modulo 4; and classification, to distinguish prime numbers from composite numbers using the numerical value and the arithmetic function Ω(n). The models were evaluated on a dataset of 999,999 primes initially. In regression experiments, only the MLP achieved satisfactory performance (R2 = 0.96; MAPE = 1.58%), while the other algorithms presented negative R2 values. In classification, the use of Ω(n) as a predictor variable resulted in perfect accuracy for most algorithms, making the problem trivial. Without Ω(n), all models were limited to predicting the majority class (composite), achieving high accuracies due to the strong class imbalance, but failing to identify any prime number (zero recall). The results indicate that the numerical value alone does not contain enough information for classification, and that feature engineering is crucial for the success of the approach. Keywords: Machine Learning; Prime Numbers; Classification; Regression; Omega Function.
This work investigates the applicability of machine learning techniques for identifying and modeling prime numbers. The KNN, Random Forest, XGBoost, and MLP algorithms were employed in two supervised tasks: regression, to predict the value of a prime based on its rank, interval, and equivalence class modulo 4; and classification, to distinguish prime numbers from composite numbers using the numerical value and the arithmetic function Ω(n). The models were evaluated on a dataset of 999,999 primes initially. In regression experiments, only the MLP achieved satisfactory performance (R2 = 0.96; MAPE = 1.58%), while the other algorithms presented negative R2 values. In classification, the use of Ω(n) as a predictor variable resulted in perfect accuracy for most algorithms, making the problem trivial. Without Ω(n), all models were limited to predicting the majority class (composite), achieving high accuracies due to the strong class imbalance, but failing to identify any prime number (zero recall). The results indicate that the numerical value alone does not contain enough information for classification, and that feature engineering is crucial for the success of the approach. Keywords: Machine Learning; Prime Numbers; Classification; Regression; Omega Function.
Description
Citation
LIMA, Victor Agster Bonache de. Utilizando técnicas de aprendizado de máquina para identificar números primos. 54 f. Monografia. (Licenciatura em Matemática) Departamento de Matemática. Universidade Federal de Viçosa. 2026.
