- Source: Euler pseudoprime
In mathematics, an odd composite integer n is called an Euler pseudoprime to base a, if a and n are coprime, and
a
(
n
−
1
)
/
2
≡
±
1
(
mod
n
)
{\displaystyle a^{(n-1)/2}\equiv \pm 1{\pmod {n}}}
(where mod refers to the modulo operation).
The motivation for this definition is the fact that all prime numbers p satisfy the above equation which can be deduced from Fermat's little theorem. Fermat's theorem asserts that if p is prime, and coprime to a, then ap−1 ≡ 1 (mod p). Suppose that p>2 is prime, then p can be expressed as 2q + 1 where q is an integer. Thus, a(2q+1) − 1 ≡ 1 (mod p), which means that a2q − 1 ≡ 0 (mod p). This can be factored as (aq − 1)(aq + 1) ≡ 0 (mod p), which is equivalent to a(p−1)/2 ≡ ±1 (mod p).
The equation can be tested rather quickly, which can be used for probabilistic primality testing. These tests are twice as strong as tests based on Fermat's little theorem.
Every Euler pseudoprime is also a Fermat pseudoprime. It is not possible to produce a definite test of primality based on whether a number is an Euler pseudoprime because there exist absolute Euler pseudoprimes, numbers which are Euler pseudoprimes to every base relatively prime to themselves. The absolute Euler pseudoprimes are a subset of the absolute Fermat pseudoprimes, or Carmichael numbers, and the smallest absolute Euler pseudoprime is 1729 = 7×13×19 (sequence A033181 in the OEIS).
Relation to Euler–Jacobi pseudoprimes
A slightly stronger test uses the Jacobi symbol to predict which of the two results will be found. The resultant Euler-Jacobi probable prime test verifies that
a
(
n
−
1
)
/
2
≡
(
a
n
)
≠
0
(
mod
n
)
.
{\displaystyle a^{(n-1)/2}\equiv \left({\frac {a}{n}}\right)\neq 0{\pmod {n}}.}
As with the basic Euler test, a and n are required to be comprime, but that test is included in the computation of the Jacobi symbol (a/n), whose value equals 0 if the values are not coprime. This slightly stronger test is called simply an Euler probable prime test by some authors. See, for example, page 115 of the book by Koblitz listed below, page 90 of the book by Riesel, or page 1003 of.
As an example of this test's increased strength, 341 is an Euler pseudoprime to the base 2, but not an Euler-Jacobi pseudoprime. Even more significantly, there are no absolute Euler–Jacobi pseudoprimes.: 1004
A strong probable prime test is even stronger than the Euler-Jacobi test but takes the same computational effort. Because of this, prime-testing software is usually based on the strong test.
Implementation in Lua
function EulerTest(k)
a = 2
if k == 1 then return false
elseif k == 2 then return true
else
m = modPow(a,(k-1)/2,k)
if (m
1) or (m
k-1) thenreturn true
else
return false
end
end
end
Examples
Least Euler pseudoprime to base n
See also
Probable prime
References
M. Koblitz, "A Course in Number Theory and Cryptography", Springer-Verlag, 1987.
H. Riesel, "Prime numbers and computer methods of factorisation", Birkhäuser, Boston, Mass., 1985.
Kata Kunci Pencarian:
- 900 (angka)
- Teorema kecil Fermat
- Euler pseudoprime
- Euler–Jacobi pseudoprime
- Pseudoprime
- Strong pseudoprime
- List of topics named after Leonhard Euler
- Lucas pseudoprime
- Carmichael number
- Frobenius pseudoprime
- Fibonacci sequence
- Prime number