The goal of this project is to reformat the data files from The Cunningham Project into a more machine readable JSON format listing all the prime factors in a list.
Currently the JSON files are created from data in the April 6, 2022 file at Sam Wagstaff's website (https://homes.cerias.purdue.edu/~ssw/cun/pmain422.txt)
So far, the following files are available:
pmain422_table2-.json
Table 2-: factorization of
pmain422_table2+.json
Table 2+: factorization of
pmain422_table2LM.json
Table 2LM: factorization of Aurifeuillean factors
Since keys in JSON are required to be strings, the values of
For instance, the following Python code will read the file
pmain422_table2-.json
into a dictionary whose key-value pairs are
import json
table2mdict = dict(map(lambda x: (int(x[0]), x[1]), json.load(open('pmain422_table2-.json','r'))['table2-_data'].items()))
print(table2mdict[12])
>> [3, 3, 5, 7, 13] # 2^12-1 = 3^2*5*7*13
The following code will return, instead of a list of prime factors, a dictionary of (prime, multiplicity) key-value pairs, similar to the output of factorint
in Sympy.
import json
from collections import Counter
table2mdict2 = dict(map(lambda x: (int(x[0]), dict(Counter(x[1]))), json.load(open('pmain422_table2-.json','r'))['table2-_data'].items()))
print(table2mdict2[18])
>> {3: 3, 7: 1, 19: 1, 73: 1} # 2^18-1 = 3^3*7*19*73
TODO:
- include values of
$m$ for which there are composite factors that have not been factored yet. - include other machine readable formats.