Euler's theorem as primality test?

  • Context: Graduate 
  • Thread starter Thread starter huba
  • Start date Start date
  • Tags Tags
    Test Theorem
Click For Summary

Discussion Overview

The discussion revolves around the application of Euler's theorem as a potential method for primality testing, particularly focusing on the expression \(2^{m-1} \equiv 1 \mod m\) and its implications for determining whether \(m\) is a prime number greater than 2. Participants explore the efficiency of this method compared to other known primality tests, such as Wilson's theorem and the square root method.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants propose that \(2^{m-1} \equiv 1 \mod m\) could indicate that \(m\) is prime when \(m > 2\).
  • Others express skepticism about the reliability of this method, noting that it does not work as a definitive primality test, citing counterexamples such as 561.
  • A participant mentions that while Euler's theorem might be more efficient than Wilson's theorem, it is still less efficient than the square root method for primality testing.
  • There is a discussion about the computational efficiency of calculating \(2^{m-1} \mod m\), with references to the number of multiplications required and potential optimizations using Fast Fourier Transforms.
  • Some participants clarify that the method discussed does not meet the criteria for identifying primes, as it can yield false positives, particularly in the case of Carmichael numbers.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the effectiveness of using Euler's theorem for primality testing. There are competing views regarding its reliability, with some asserting it is insufficient while others initially suggest it could work under certain conditions.

Contextual Notes

Limitations include the dependence on specific definitions of primality tests and the unresolved nature of the computational efficiency claims. The discussion also highlights the existence of counterexamples that challenge the proposed method.

huba
Messages
32
Reaction score
0
Using "[URL theorem[/URL], and the fact that [tex]\varphi(p) = p - 1[/tex] when p is prime, and the fact that 2 is coprime to all odd numbers, is it right to say that

[tex]2^{m-1} \equiv 1 \ (mod \ m)[/tex] iff m is prime > 2?
 
Last edited by a moderator:
Physics news on Phys.org
huba said:
Using "[URL theorem[/URL], and the fact that [tex]\varphi(p) = p - 1[/tex] when p is prime, and the fact that 2 is coprime to all odd numbers, is it right to say that

[tex]2^{m-1} \equiv 1 \ (mod \ m)[/tex] iff m is prime > 2?

Yes, I think so.
 
Last edited by a moderator:
Thanks. My question was related to another thread about prime numbers which resulted in the observation that Wilson's theorem can be used to test if an odd number is prime, but it is a far less efficient way of testing primality than trying factors <= the square root of a number.
I assume that Euler's theorem offers a primality testing method which is better than Wilson's theorem but still worse than the "square root method", in terms of the efficiency of the necessary computation. Does [tex]2^{m-1}[/tex] have to be calculated to check if [tex]2^{m-1}\equiv \ 1 (mod \ m)[/tex], or is there a shortcut?
 
Note that to calculate e.g., 232 you don't need to do 31 multiplications. 5 is enough.
[tex] \begin{align*}<br /> &2^2=4,\\<br /> &2^4=4^2=16,\\<br /> &2^8=16^2=256,\\<br /> &2^{16}=256^2=65536,\\<br /> &2^{32}=65536^2=4294967296.<br /> \end{align*}[/tex]
To calculate 2(m-1) will require on the order of log(m) multiplications and additions. As you only need to do it modulo n, the multiplications are done on numbers no bigger than n.

Multiplying two numbers of size about n requires log(n)2 operations using the normal method of multiplication that you learn as a kid, because they will have log(n) digits.
However, Fast Fourier Transforms can improve this to log(n)log(log(n)).

Altogether, this gives a time on the order of log(n)2log(log(n)) to calculate 2n-1 modulo n.

However, does this really work as a primality test?

edit: it doesn't. Just tried some examples and got 561 = 3 * 11 * 17 is not prime, but 2560=1 (mod 561).
 
Last edited:
ehrenfest said:
Yes, I think so.

No, it's not. Primes may be in P, but not by doing this. What you're describing isn't even as strong as being a Carmichael number.
 
matt grime said:
No, it's not. Primes may be in P, but not by doing this. What you're describing isn't even as strong as being a Carmichael number.

Ah, looking at http://en.wikipedia.org/wiki/Carmichael_number" I see that my counterexample of 561 is actually the smallest Carmichael number.
 
Last edited by a moderator:
actually, 341=11*13 is the smallest counterexample. 2340=(210)34= 134=1 (mod 341).
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 31 ·
2
Replies
31
Views
3K
  • · Replies 12 ·
Replies
12
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 17 ·
Replies
17
Views
7K
Replies
16
Views
3K