Professional Documents
Culture Documents
Primality
Primality
Primality
Ramprasad Saptharishi
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
Theorem
If n is prime, then (X − a)n = X n − a (modn)
If gcd(a, n) = 1 and n is composite, then
(X − a)n 6= X n − a (modn)
Theorem
If n is prime, then (X − a)n = X n − a (modn)
If gcd(a, n) = 1 and n is composite, then
(X − a)n 6= X n − a (modn)
Algorithm:
Check if (X − 1)n = X n − 1 (modn) and output accordingly.
Repeated Squaring:
i
Compute pi = (X − 1)2 .
Use the binary representation of n and multiply appropriate pi s to compute
(X − a)n
Repeated Squaring:
i
Compute pi = (X − 1)2 .
Use the binary representation of n and multiply appropriate pi s to compute
(X − a)n
[Pingala200BC]: Journal Publication in Chandah-Sutra
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
(X − a)n = X n − a (mod X r − 1, p)
(X − a)p = X p − a (mod X r − 1, p)
the second one coming for free from Fermat’s little theorem.
Claim
If m1 and m2 are introspective numbers, that is for all 1 ≤ a ≤ s
(X − a)m1 = X m1 − a (mod X r − 1, p)
(X − a)m2 = X m2 − a (mod X r − 1, p)
then so is m1 m2
(X − a)m1 m2 = X m1 m2 − a (mod X r − 1, p)
Proof.
(X − a)m2 − (X m2 − a) = (X r − 1)g (X )
Proof.
(X − a)m2 − (X m2 − a) = (X r − 1)g (X )
=⇒ (X m1 − a)m2 − (X m1 m2 − a) = (X m1 r − 1)g (X m1 )
Proof.
(X − a)m2 − (X m2 − a) = (X r − 1)g (X )
=⇒ (X m1 − a)m2 − (X m1 m2 − a) = (X m1 r − 1)g (X m1 )
= 0 (mod X r − 1, p)
Proof.
(X − a)m2 − (X m2 − a) = (X r − 1)g (X )
=⇒ (X m1 − a)m2 − (X m1 m2 − a) = (X m1 r − 1)g (X m1 )
= 0 (mod X r − 1, p)
=⇒ (X − a)m1 m2 = (X m1 − a)m2
Proof.
(X − a)m2 − (X m2 − a) = (X r − 1)g (X )
=⇒ (X m1 − a)m2 − (X m1 m2 − a) = (X m1 r − 1)g (X m1 )
= 0 (mod X r − 1, p)
=⇒ (X − a)m1 m2 = (X m1 − a)m2
= X m1 m2 − a (mod X r − 1, p)
(X − a)n = X n − a (mod X r − 1, p)
(X − a)p = X p − a (mod X r − 1, p)
Claim
If m1 , m2 ∈ L are such that
for a = 1, 2, . . . , s, then m1 = m2
Claim
If m1 , m2 ∈ L are such that
for a = 1, 2, . . . , s, then m1 = m2
Once we have this, then p i1 nj1 = p i2 nj2 , and this implies that n = p s .
Claim
If m1 , m2 ∈ L are such that
for a = 1, 2, . . . , s, then m1 = m2
Once we have this, then p i1 nj1 = p i2 nj2 , and this implies that n = p s . And
since we assumed n is composite, s ≥ 2, and checking if n is a power of a
prime is easy and can be added in the preliminary tests.
Claim
If m1 , m2 ∈ L are such that
for a = 1, 2, . . . , s, then m1 = m2
Once we have this, then p i1 nj1 = p i2 nj2 , and this implies that n = p s . And
since we assumed n is composite, s ≥ 2, and checking if n is a power of a
prime is easy and can be added in the preliminary tests.
All that’s left now is to choose the parameters that force m1 = m2 .
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
Theorem
In field, a non-zero polynomial of degree d has at most d roots.
Theorem
In field, a non-zero polynomial of degree d has at most d roots.
(η − a)m1 = (η − a)m2
(η − a)m1 = (η − a)m2
(η − a)m1 = (η − a)m2
is a root of h.
(η − a)m1 = (η − a)m2
(η − a)m1 = (η − a)m2
Suppose we look at
s
( )
Y
SX = (X − a)δa |δa ∈ {0, 1}
a=1
Suppose we look at
s
( )
Y
SX = (X − a)δa |δa ∈ {0, 1}
a=1
Suppose we look at
s
( )
Y
SX = (X − a)δa |δa ∈ {0, 1}
a=1
Suppose we look at
s
( )
Y
SX = (X − a)δa |δa ∈ {0, 1}
a=1
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
Lemma
The LCM of 1, 2, . . . 2k + 1 is atleast 22k
Lemma
The LCM of 1, 2, . . . 2k + 1 is atleast 22k
Proof.
Z 1
−2k
2 ≥ [x(1−x)]k dx
0
Lemma
The LCM of 1, 2, . . . 2k + 1 is atleast 22k
Proof.
Z 1 k Z 1 k
−2k k
X k X Mi
2 ≥ [x(1−x)] dx = (−1)i x k+i dx =
0 i 0 k +i +1
i=0 i=0
Lemma
The LCM of 1, 2, . . . 2k + 1 is atleast 22k
Proof.
Z 1 k Z 1 k
−2k k
X k X Mi M
2 ≥ [x(1−x)] dx = (−1)i x k+i dx = =
0 i 0 k +i +1 L
i=0 i=0
Lemma
The LCM of 1, 2, . . . 2k + 1 is atleast 22k
Proof.
Z 1 k Z 1 k
−2k k
X k X Mi M
2 ≥ [x(1−x)] dx = (−1)i x k+i dx = =
0 i 0 k +i +1 L
i=0 i=0
Suppose we run through all r till some odd number say R and fail to get
one such that ordr (n) > T = 4(log2 n) + 2.
Suppose we run through all r till some odd number say R and fail to get
one such that ordr (n) > T = 4(log2 n) + 2. Then each r ≤ R divides
T
2
Y
(ni − 1) ≤ nT
i=0
Suppose we run through all r till some odd number say R and fail to get
one such that ordr (n) > T = 4(log2 n) + 2. Then each r ≤ R divides
T
2
Y
(ni − 1) ≤ nT
i=0
and hence the LCM of all r ≤ R divides it. By the earlier lemma, we must
2
have 2R−1 ≤ nT that is R ≤ T 2 log n + 1.
Suppose we run through all r till some odd number say R and fail to get
one such that ordr (n) > T = 4(log2 n) + 2. Then each r ≤ R divides
T
2
Y
(ni − 1) ≤ nT
i=0
and hence the LCM of all r ≤ R divides it. By the earlier lemma, we must
2
have 2R−1 ≤ nT that is R ≤ T 2 log n + 1. Hence there is a number
r = O(log5 n) with ordr (n) ≥ T .
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials
Theorem
For any fixed r and any t > 0,
if and only if
Theorem
For any fixed r and any t > 0,
if and only if
1 Introduction
2 The Idea
3 Towards Correctness
7 Different Polynomials