Problems & Puzzles: Puzzles
|
Problems & Puzzles: Puzzles
From Feb 21-27, 2026 contributions came from Emmanuel Vantieghem, Carlos Rivera, Sebastián Martín Ruiz, Ashaz Jameel,
*** Emmanuel wrote: Programmation language used: I used the following Mathematica program (V 13.0) to perform Ruiz's test twice for each prime: the first time with the Ruiz Test and the second time with the built -in primality test from Matyematica. Here are my results: Code in Mathematica of the SMR test:
SMRQ[p_] := If[Mod[p, 4] != 3, 0== 1,
Module[{},If[PowerMod[1 + I, p, p] != 1 - I, 1 == 0,If[PowerMod[1 + 2 I, p, p] != 1 - 2 I, 1 == 0, 1 == 1]]]] Results:
If p = 10^9999 + 33603, then Timing[SMRQ[p]] gives :
{14.9375", True}.
Mathematica's built-in program Timing[PrimeQ[p] gives :
{15.375", True},
a bit longer as you see.
If p = 2^176177 + 60947 then Timing[SMRQ[p]] gives :
{911.609375", True}
Mathematica's built-in program Timing[PrimeQ[p] gives :
{{936.71875", True}.
a bit longer as you see.
Comments Seemingly, SMRQ would be a quicker test for primality.
In my opinion, SMRQ performs four Fermat primality checks. The chance
that we meet a counterexample is very small
but still possible.
PC used:
Some characteristics of my PC :
System type : x64-based PC
Processor 11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz, 3912 MHz, 6
core('s), 12 logical processor(s)
Memory RAM installed ; 16GB
Windows 11.
*** Carlos Rivera wrote: Results: *** Sebastián wrote:
Here are my results
Languaje Code: MATHEMATICA 13.3
Code:
n1 = 10^9999 + 33603;
p = n1; If[PowerMod[1 + I, p, p] == 1 - I && PowerMod[1 + 2 I, p, p] == 1 - 2 I, Print[prime], Print[composite]]; Print[time, " ", Timing[PowerMod[1 + I, p, p]][[1]] + Timing[PowerMod[1 + 2 I, p, p]][[1]], " ", sec] prime time 13.625 sec n2 = 2^176177 + 60947; p = n2; If[PowerMod[1 + I, p, p] == 1 - I && PowerMod[1 + 2 I, p, p] == 1 - 2 I, Print[prime], Print[composite]]; Print[time, " ", Timing[PowerMod[1 + I, p, p]][[1]] + Timing[PowerMod[1 + 2 I, p, p]][[1]], " ", sec] prime time 722.766 sec
PC characteristics
Desktop SFF-12 Gen-Intel Core i5 12400,16 GB DDR4. Windows 11 PRO
*** Ashaz Jameel wrote:
As (1+i)^n is periodic, we don't need to calculate what (1+i)^n is, as
it will be of the form (1-i ) when n = 3 or 7 mod 8, which is given in
the initial conditions of the equation.
So all we are really checking for is if
2^floor(p/2) mod p = ±1
(I haven't checked, but I feel as if this may link to an already
existing prime checking algorithm)
Writing this in python is simple enough. Using this equation I have
tested all primes up to 10^8 and they all hold. What I find strange is
that this equation holds both for primes 3 mod 4 and for primes 1 mod 4,
despite the original equation only working for primes 3 mod 4. Also the
original conjecture required a second congruence, however this equation
uses only the first congruence and the equation still holds.
For n1, it is able to calculate it in 110 seconds using an intel
i5-9400. For n2 it took 15,220 seconds.
Regardless, this is just fermats little theorem, so shouldn't make a
major difference to prime hunting
As for the largest prime proven with this program, I was able to prove
the 28th Mersenne prime to be prime in around 5 minutes
(25,962 digits)
Desmos file: https://www.desmos.com/
***
|
|||
|
|||