Problems & Puzzles: Conjectures

Conjecture 109. Another test of Primality

On Jan 1, 2026 Sebastián Martín Ruiz sent the following Conjecture.

Conjecture:
p>3,  p=3 (mod 4) p is prime
if and only if
(1+i)^p=1-i (mod p) and (1+2i)^p=1-2i (mod p).

Q1. Prove this conjecture or find a counterexample.

Q2. This conjecture has been tested up to p<10^9. Can you test it far beyond?

Q3. Send the largest prime (original of you or not) that you can prove using this test, reporting the time spent in your computer.

Additional notes by SMR:

a) The test of Lucas-Lehmer for Mersenne primes Mp has a complexity O(p^2 log p log log p)
and the conjecture test has a complexity O(p^3), but the conjecture test is for all type of primes

b) Congruences modulo p are also defined for Gaussian integers, which are complex numbers
of the form a+bi with a and b being integers. It should be noted that this Conjecture is an equivalence; that is, it is enough to prove both congruences and the number will be prime. Two other complex numbers other than 1+i and 1+2i could also be used, but the larger the modulus, the slower the calculation.

c) With my PC computer, I have verified this well-known prime
p=2996863034895*2^1290000-1 of approximately
360,000 digits and it took 17 hours and 11 minutes of CPU time.

d) The MATHEMATICA program has a function that performs these PowerMod congruences,
and when applied twice:
PowerMod(1+i,p,p)=1-i
PowerMod(1+2i,p,p)=1-2i
checks if p is prime.

This is a polynomial-time algorithm, and with a good computer, it would be possible to check
the largest known primes, that is, the Mersenne primes, the largest of which has 41 million digits.

e) Curiously, for very large primes, the vast majority already tested & reported are congruent to 3 (mod 4). Those congruent to 1 (mod 4) are very rare.

f) Comparative times table, running both tests in SMR PC:

Mersenne prime, Test Lucas Lehmer time, SMR Conjecture Time

M86243, 36.7 sec, 106.4 sec

M132049, 77.7 sec, 291.2 sec

M216091, 246.4 sec, 781.9 sec


During January 10 to 16, 2025, contributions came from Emmanuel Vantieghem

***

Emmanuel wrote:

I could not find a counterexample below 10^12.
If we restrict  m  to Mersenne numbers (i. e. : numbers of the form 2^p - 1) 
I found no counterexample with  p < 59600.
However, it is easy to prove that the first congruence always holds for such numbers:


In my opinion there might be a proof for the second congruence too, but at this time I do not see how.

***

 

Records   |  Conjectures  |  Problems  |  Puzzles