Skip to content

Files

Latest commit

20b1625 · Jun 27, 2024

History

History

This set of C++ (https://en.wikipedia.org/wiki/C%2B%2B) programs must be run with GMP (https://gmplib.org/, https://en.wikipedia.org/wiki/GNU_Multiple_Precision_Arithmetic_Library)

This set of programs uses many number theoretic (https://en.wikipedia.org/wiki/Number_theory, https://www.rieselprime.de/ziki/Number_theory, https://mathworld.wolfram.com/NumberTheory.html) functions in GMP library (see https://gmplib.org/manual/Number-Theoretic-Functions.html), and we use the GMP function mpz_probab_prime_p (see https://faculty.lynchburg.edu/~nicely/misc/mpzspsp.html) to test the probable primality of the numbers, this function is combination of the Baillie–PSW probable primality test (https://en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_test, https://mathworld.wolfram.com/Baillie-PSWPrimalityTest.html), the Miller–Rabin probable primality test (https://t5k.org/prove/prove2_3.html, https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test, https://en.wikipedia.org/wiki/Strong_pseudoprime, https://t5k.org/glossary/xpage/MillersTest.html, https://t5k.org/glossary/xpage/StrongPRP.html, https://www.rieselprime.de/ziki/Miller-Rabin_pseudoprimality_test, https://mathworld.wolfram.com/Rabin-MillerStrongPseudoprimeTest.html, https://mathworld.wolfram.com/StrongPseudoprime.html, http://www.numericana.com/answer/pseudo.htm#rabin, http://www.numericana.com/answer/pseudo.htm#strong, http://www.javascripter.net/math/primes/millerrabinprimalitytest.htm, http://ntheory.org/data/spsps.txt, https://faculty.lynchburg.edu/~nicely/misc/mpzspsp.html, https://miller-rabin.appspot.com/, http://www.pi-e.de/Miller-Rabin-Pseudoprimzahlen.htm (in German), http://factordb.com/prooffailed.php, https://sites.google.com/view/strong-pseudoprime, https://sites.google.com/view/bases-strong-pseudoprime, https://oeis.org/A001262, https://oeis.org/A020229, https://oeis.org/A020231, https://oeis.org/A020233, https://oeis.org/A072276, https://oeis.org/A056915, https://oeis.org/A074773, https://oeis.org/A014233, https://oeis.org/A006945, https://oeis.org/A089825, https://oeis.org/A181782, https://oeis.org/A071294, https://oeis.org/A141768, https://oeis.org/A195328, https://oeis.org/A329759, https://oeis.org/A298756) of first 50 prime bases (see https://oeis.org/A014233 and https://oeis.org/A141768 and https://oeis.org/A001262 and https://oeis.org/A074773) (we use reps = 50, thus the first 50 prime bases), and trial division (https://en.wikipedia.org/wiki/Trial_division, https://t5k.org/glossary/xpage/TrialDivision.html, https://www.rieselprime.de/ziki/Trial_factoring, https://mathworld.wolfram.com/TrialDivision.html, http://www.numericana.com/answer/factoring.htm#trial, https://www.mersenne.ca/tf1G/, https://www.mersenne.ca/tfmissed.php, https://oeis.org/A189172) to about 109, thus all numbers in the data are Baillie–PSW probable primes (i.e. both strong probable primes to base 2 (see https://oeis.org/A001262) and strong Lucas pseudoprimes (https://en.wikipedia.org/wiki/Strong_Lucas_pseudoprime, https://mathworld.wolfram.com/StrongLucasPseudoprime.html, http://ntheory.org/data/slpsps-baillie.txt) with parameters (P, Q) defined by Selfridge's Method A (see https://oeis.org/A217255)), i.e. either primes or Baillie–PSW pseudoprimes, and no known composites which pass the Baillie–PSW probable prime test, and no composites < 264 pass the Baillie–PSW probable prime test (see http://ntheory.org/pseudoprimes.html and https://faculty.lynchburg.edu/~nicely/misc/bpsw.html), thus if a number in the data is in fact composite, it will be a pseudoprime to the Baillie–PSW probable prime test, which currently no single example is known!

The program "searchpp.cc" is searching the smallest (probable) prime in non-simple families (for the examples of non-simple families, see https://web.archive.org/web/20240305201337/https://stdkmd.net/nrr/prime/primecount3.htm and https://web.archive.org/web/20240305201316/https://stdkmd.net/nrr/prime/primecount3.txt (only base 10 families)), non-simple families usually have small primes if they cannot be ruled out as only containing composites by covering congruence, see the README file in the main page.

(the section below uses the notation in http://www.cs.uwaterloo.ca/~shallit/Papers/minimal5.pdf (cached copy at https://github.com/xayahrainie4793/pdf-files-cached-copy/blob/main/pdf_11.pdf), i.e. "XY" means "X is a subsequence of Y")

e.g. for the non-simple family {7}{4}1 in base b = 8, we can separate it to these families:

and thus we found that the smallest prime in the non-simple family {7}{4}1 in base 8 is 77774444441 (8589035809 in decimal)

For another example, for the non-simple family {8}{3}5 in base b = 9, we can separate it to these families:

and thus we found that the smallest prime in the non-simple family {8}{3}5 in base 9 is 8333333335 (3244646597 in decimal)

The program "searchpm.cc" is searching the smallest (probable) prime in simple families up to length 1000.

The program "searchp1.cc" is searching the smallest (probable) prime in simple families extensively, starting with length 1000.

The program "searchLLR.cc" is a sieving (https://www.rieselprime.de/ziki/Sieving, https://www.rieselprime.de/ziki/Sieving_a_range_of_sequences, https://mathworld.wolfram.com/Sieve.html, http://www.rechenkraft.net/yoyo/y_status_sieve.php, https://www.primegrid.com/stats_psp_sieve.php, https://www.primegrid.com/stats_pps_sieve.php, https://www.primegrid.com/stats_sr5_sieve.php, https://www.primegrid.com/stats_cw_sieve.php) program like SRSIEVE (https://www.bc-team.org/app.php/dlext/?cat=3, http://web.archive.org/web/20160922072340/https://sites.google.com/site/geoffreywalterreynolds/programs/, https://www.mersenneforum.org/showpost.php?p=631129&postcount=1, http://www.rieselprime.de/dl/CRUS_pack.zip, https://t5k.org/bios/page.php?id=905, https://www.rieselprime.de/ziki/Srsieve, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/srsieve_1.1.4, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/sr1sieve_1.4.6, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/sr2sieve_2.0.0, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/srbsieve_1.8.2, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/srbsieve-other-programs, https://github.com/xayahrainie4793/prime-programs-cached-copy/blob/main/mtsieve_2.4.8/srsieve2.exe, https://github.com/xayahrainie4793/prime-programs-cached-copy/blob/main/mtsieve_2.4.8/srsieve2cl.exe) but not remove the numbers with algebraic factors (see https://www.mersenneforum.org/showpost.php?p=452132&postcount=66 and https://www.mersenneforum.org/showpost.php?p=451337&postcount=32 and https://www.mersenneforum.org/showpost.php?p=232904&postcount=604 and https://www.mersenneforum.org/showthread.php?t=21916 and https://www.mersenneforum.org/showpost.php?p=383690&postcount=1 and https://www.mersenneforum.org/showpost.php?p=207886&postcount=253 and https://github.com/xayahrainie4793/prime-programs-cached-copy/blob/main/srsieve_1.1.4/algebraic.c (note: for the sequence (a×bn+c)/gcd(a+c,b−1), the case of "Mersenne number" in https://github.com/xayahrainie4793/prime-programs-cached-copy/blob/main/srsieve_1.1.4/algebraic.c is the case which a is rational power of b, c = −1 and the case which a is rational power of b, c = 1, gcd(a+c,b−1) ≥ 3, and the case of "GFN" in https://github.com/xayahrainie4793/prime-programs-cached-copy/blob/main/srsieve_1.1.4/algebraic.c is the case which a is rational power of b, c = 1, gcd(a+c,b−1) is either 1 or 2)), and the program "searchLLR.cc" prints the LLR (http://jpenne.free.fr/index2.html, https://t5k.org/bios/page.php?id=431, https://www.rieselprime.de/ziki/LLR, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/llr403win64, https://github.com/xayahrainie4793/prime-programs-cached-copy/tree/main/llr403linux64) input file and thus the LLR program must be used after the program "searchLLR.cc".

(sorry, I do not give the sieve files of this problem in the pages, for the examples of the sieve files, see http://www.noprimeleftbehind.net/crus/sieve-sierp-base3-14G-20G-50K-100K.zip (Sierpinski problem base 3, k = 14000000000 to 20000000000, n = 50000 to 100000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base3-20G-30G-50K-100K.zip (Sierpinski problem base 3, k = 20000000000 to 30000000000, n = 50000 to 100000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base3-30G-40G-50K-100K.zip (Sierpinski problem base 3, k = 30000000000 to 40000000000, n = 50000 to 100000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base10-5M-10M.txt (Sierpinski problem base 10, n = 5000000 to 10000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base16-1M-2M.zip (Sierpinski problem base 16, n = 1000000 to 2000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base22-2M-5M.txt (Sierpinski problem base 22, n = 2000000 to 5000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base25-350K-1M.zip (Sierpinski problem base 25, n = 350000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base26-2M-3M.txt (Sierpinski problem base 26, n = 2000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base27-2M-5M.txt (Sierpinski problem base 27, n = 2000000 to 5000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base28-1M-3M.txt (Sierpinski problem base 28, n = 1000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base35-100K-500K.zip (Sierpinski problem base 35, n = 100000 to 500000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base37-1M-3M.txt (Sierpinski problem base 37, n = 1000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base43-1M-3M.txt (Sierpinski problem base 43, n = 1000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base45-400K-1M.zip (Sierpinski problem base 45, n = 400000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base46-700K-1M.txt (Sierpinski problem base 46, n = 700000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base48-700K-1M.txt (Sierpinski problem base 48, n = 700000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base52-500K-1M.zip (Sierpinski problem base 52, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base53-k4-3M-5M.txt (Sierpinski problem base 53, k = 4, n = 3000000 to 5000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base53-700K-1M.txt (Sierpinski problem base 53, all k except k = 4, n = 700000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base55-1M-3M.zip (Sierpinski problem base 55, n = 1000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base60-500K-1M.zip (Sierpinski problem base 60, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-sierp-base61-500K-1M.txt (Sierpinski problem base 61, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-R2-2nd-conj-8M-10M.zip (2nd Riesel problem base 2, n = 8000000 to 10000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base3-k3677878-0M-50M.zip (Riesel problem base 3, k = 3677878, n = 0 to 50000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base3-11G-20G-100K-200K.zip (Riesel problem base 3, k = 11000000000 to 20000000000, n = 100000 to 200000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base6-5.6M-15M.txt (Riesel problem base 6, n = 5600000 to 15000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base7-300M-400M-25K-100K.zip (Riesel problem base 7, k = 300000000 to 400000000, n = 25000 to 100000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base7-400M-500M-25K-100K.zip (Riesel problem base 7, k = 400000000 to 500000000, n = 25000 to 100000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base10-4M-5M.txt (Riesel problem base 10, n = 4000000 to 5000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base16-1M-2M.txt (Riesel problem base 16, n = 1000000 to 2000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base23-2M-5M.txt (Riesel problem base 23, n = 2000000 to 5000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base24-260K-500K.zip (Riesel problem base 24, n = 260000 to 500000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base25-300K-1M.zip (Riesel problem base 25, n = 300000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base28-1M-3M.txt (Riesel problem base 28, n = 1000000 to 3000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base36-465K-2M.zip (Riesel problem base 36, n = 465000 to 2000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base37-500K-1M.txt (Riesel problem base 37, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base42-500K-1M.zip (Riesel problem base 42, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base45-500K-1M.txt (Riesel problem base 45, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base46-500K-1M.txt (Riesel problem base 46, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base48-500K-1M.zip (Riesel problem base 48, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base55-500K-1M.txt (Riesel problem base 55, n = 500000 to 1000000) and http://www.noprimeleftbehind.net/crus/sieve-riesel-base60-400K-1M.zip (Riesel problem base 60, n = 400000 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.17.txt (original minimal prime problem base 17, n = 1000000 to 2000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.19.txt (original minimal prime problem base 19, n = 707348 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.21.txt (original minimal prime problem base 21, n = 506720 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.25.txt (original minimal prime problem base 25, n = 300000 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.26.txt (original minimal prime problem base 26, n = 486721 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.27.txt (original minimal prime problem base 27, n = 360000 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.28.txt (original minimal prime problem base 28 (in fact also this new minimal prime problem base 28), n = 543202 to 1000000) and https://raw.githubusercontent.com/curtisbright/mepn-data/master/data/sieve.29.txt (original minimal prime problem base 29, n = 240000 to 1000000) and https://kurtbeschorner.de/db-details-3-1M.htm (family {1} in decimal) and https://www.alfredreichlg.de/10w7/prp/ProofFile.200001-1000000.txt (family 1{0}7 in decimal) and https://www.alfredreichlg.de/10w7/prp/ProofFile.1000001-1075000.txt (family 1{0}7 in decimal) and https://oeis.org/A076336/a076336d.html (4847×2n+1) and http://web.archive.org/web/20050929031631/http://robin.mathi.com/28433/ (28433×2n+1) and https://www.primegrid.com/sieving/rsp/rsp1M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 1 ≤ n ≤ 1000000) and https://www.primegrid.com/sieving/rsp/rsp2M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 1000001 ≤ n ≤ 2000000) and https://www.primegrid.com/sieving/rsp/rsp3M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 2000001 ≤ n ≤ 3000000) and https://www.primegrid.com/sieving/rsp/rsp4M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 3000001 ≤ n ≤ 4000000) and https://www.primegrid.com/sieving/rsp/rsp5M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 4000001 ≤ n ≤ 5000000) and https://www.primegrid.com/sieving/rsp/rsp6M_20150702.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 5000001 ≤ n ≤ 6000000) and https://www.primegrid.com/sieving/rsp/rsp7M_20230827.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 6000001 ≤ n ≤ 7000000) and https://www.primegrid.com/sieving/rsp/rsp8M_20230827.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 7000001 ≤ n ≤ 8000000) and https://www.primegrid.com/sieving/rsp/rsp9M_20230827.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 8000001 ≤ n ≤ 9000000) and https://www.primegrid.com/sieving/rsp/rsp10M_20240504.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 9000001 ≤ n ≤ 10000000) and https://www.primegrid.com/sieving/rsp/rsp11M_20240504.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 10000001 ≤ n ≤ 11000000) and https://www.primegrid.com/sieving/rsp/rsp12M_20240504.7z (k×2n−1, 5 ≤ k ≤ 9999, k odd, 11000001 ≤ n ≤ 12000000) and https://www.primegrid.com/sieving/rsp/rsp1M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 1 ≤ n ≤ 1000000) and https://www.primegrid.com/sieving/rsp/rsp2M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 1000001 ≤ n ≤ 2000000) and https://www.primegrid.com/sieving/rsp/rsp3M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 2000001 ≤ n ≤ 3000000) and https://www.primegrid.com/sieving/rsp/rsp4M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 3000001 ≤ n ≤ 4000000) and https://www.primegrid.com/sieving/rsp/rsp5M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 4000001 ≤ n ≤ 5000000) and https://www.primegrid.com/sieving/rsp/rsp6M_20150702_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 5000001 ≤ n ≤ 6000000) and https://www.primegrid.com/sieving/rsp/rsp7M_20230827_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 6000001 ≤ n ≤ 7000000) and https://www.primegrid.com/sieving/rsp/rsp8M_20230827_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 7000001 ≤ n ≤ 8000000) and https://www.primegrid.com/sieving/rsp/rsp9M_20230827_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 8000001 ≤ n ≤ 9000000) and https://www.primegrid.com/sieving/rsp/rsp10M_20240504_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 9000001 ≤ n ≤ 10000000) and https://www.primegrid.com/sieving/rsp/rsp11M_20240504_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 10000001 ≤ n ≤ 11000000) and https://www.primegrid.com/sieving/rsp/rsp12M_20240504_k_lt_300.7z (k×2n−1, 5 ≤ k ≤ 299, k odd, 11000001 ≤ n ≤ 12000000))

There is also a Pari/GP (https://pari.math.u-bordeaux.fr/, https://en.wikipedia.org/wiki/PARI/GP) program code to compute the first few minimal primes (say < 232) in base b (this program looks at all primes one by one, to test whether a prime is a minimal prime or not, and has time complexity (https://en.wikipedia.org/wiki/Time_complexity) O(n) when compute the minimal primes ≤ n (where O is the big O notation (https://en.wikipedia.org/wiki/Big_O_notation, https://t5k.org/glossary/xpage/BigOh.html, https://mathworld.wolfram.com/Big-ONotation.html)), thus this program would need a time longer than the age of the universe (https://en.wikipedia.org/wiki/Age_of_the_universe) to test to the largest minimal prime for base b = 10 (i.e. 5000000000000000000000000000027), even if we can test 106 primes per second (https://en.wikipedia.org/wiki/Second)), hence to do this is impractically, not to mention base b = 24, whether the set of the C++ programs in this page has time complexity (https://en.wikipedia.org/wiki/Time_complexity) O(log(n)3) (where log is the natural logarithm (https://en.wikipedia.org/wiki/Natural_logarithm, https://t5k.org/glossary/xpage/Log.html, https://mathworld.wolfram.com/NaturalLogarithm.html)) when compute the minimal primes ≤ n, thus it has a polynomial time (https://en.wikipedia.org/wiki/Polynomial_time, https://mathworld.wolfram.com/PolynomialTime.html)):

a(n,k,b)=v=[];for(r=1,length(digits(n,b)),if(r+length(digits(k,2))-length(digits(n,b))>0 && digits(k,2)[r+length(digits(k,2))-length(digits(n,b))]==1,v=concat(v,digits(n,b)[r])));fromdigits(v,b)

g(n)=if(n<10,n+48,n+55)

f(n,b)=for(k=1,length(digits(n,b)),print1(Strchr(g(digits(n,b)[k]))))

is(n,b)=for(k=1,2^length(digits(n,b))-2,if(ispseudoprime(a(n,k,b)) && a(n,k,b)>=b+1,return(0)));1

c(b)=forprime(p=b+1,2^32,if(is(p,b),f(p,b);print1(", ")))