SlideShare a Scribd company logo
PRIMES is in P: A Breakthrough for Everyman
F. Bornemann (based on Agarwal ’04)

Dhruv Gairola
Computational Complexity, Michael Soltys
gairold@mcmaster.ca ; dhruvgairola.blogspot.ca

October 22, 2013

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

1 / 10
Overview

1

Primality Testing
Introduction
Existing Methods

2

Contribution
Intuition
AKS Algorithm
Time Complexity

3

Reception

4

Conclusion

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

2 / 10
Primality Testing : Introduction

Primes are greater than 1 and have no positive divisors other than 1
and itself. Non primes are composite numbers.
PRIMES is the decisional problem of determining whether or not a
given integer n is prime.
Important in cryptography (e.g., RSA)
Finding large ”random” primes.
Number of primes less than x is about x / ln x.
Test O(k) random k-bit numbers you will probably find a prime.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

3 / 10
Primality Testing : Existing Methods
Sieve of Eratosthenes
Ancient, iterative method to generate primes between 1 and n.
Simple but exponential, esp. in crypto where we are interested in large
numbers.

Fermats Little Theorem
If p is prime, for every a coprime to p, ap−1 ≡ 1 (mod p)
Try lots of a’s, if always holds p is probably prime.
Carmichael numbers (rare).

Rabin Miller Test
Randomized, fast.
Definitely composites; finds primes with high probability .
PRIMES ∈ co-RP (i.e., false positives exist but no false negatives).

ECPP (Elliptic curve primality proving)
Result is error free but expected polynomial running time.

No deterministic, polynomial time algorithm! (Miller 1976?)
Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

4 / 10
Contribution : Intuition

AKS algorithm : deterministic and polynomial time. Based on
generalization of Fermat’s Little Theorem.
Theorem : Suppose a and p are coprime with p > 1. p is prime iff
(X + a)p ≡ X p + a (mod p)
X is an indeterminate variable.
Formally, we have the identity (X + a)p = X p + a in the ring Z[X] of
polynomials of one variable X over the finite field Z of p elements.

Check different values of a, but there are p possible choices of a.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

5 / 10
Contribution : Intuition (2)

Don’t look at (X + a)p , look at remainder after division by (X r − 1)
where r is coprime to a.
Fewer coefficients to compare with :
(X + a)p ≡ X p + a (mod X r − 1, p)
i.e., mod by X r − 1 first and then mod by n.
True for certain composites. Impose certain conditions, arrive at key
AKS theorem.
Proof is rather long, but ”simple” enough.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

6 / 10
Contribution : AKS Algorithm

AKS Algorithm (pseudocode of AKS Theorem)
1

Decide if p is a power of a natural number. If so, go to step 5.

2

Choose variables satisfying the hypotheses of the AKS theorem.

3

For a = 1, . . . , (s − 1) do the following:
(i) If a is a divisor of p, go to step 5.
(ii) If (X − a)p ≡ X p − a (mod X r − 1, p), go to step 5.

4

p is prime. Done.

5

p is composite. Done.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

7 / 10
Contribution : Time Complexity

˜
Original paper : O(log 10.5 n)
10.5 n · poly (loglogn)).
i.e., O(log
i.e., O(log 10.5 n · (loglogn)O(1) ).
˜
Assuming Sophie Germain conjecture : O(log 6 n).
A Sophie-Germain prime is a prime q such that r = 2q + 1 is also
prime. Conjectured that infinitely many Sophie-Germain primes.
Computation of variables in the AKS theorem becomes faster.

Other improvements are no longer ”simple” to understand.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

8 / 10
Reception

Media
Misleading portrayal.
e.g., NYT ”quick and definitively”; WSJ ”One beautiful mind from
India is putting the Internet on alert”.

Scientific Community
Godel Prize, Fulkerson Prize.
Proposed extensions.

Industry
Not utilized. Variations of Rabin Miller used instead.
Randomized algorithms faster with extremely low probability of error.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

9 / 10
Conclusion

Deterministic, polynomial
algorithm for primality
testing.
Important result in
complexity theory but
efficient algorithms still
preferred practically.
Million dollar prize :
Riemann hypothesis.

Dhruv Gairola (McMaster Univ.)

PRIMES is in P

October 22, 2013

10 / 10

More Related Content

PDF
Galois theory andrew hubery
PPTX
#3 formal methods – propositional logic
PDF
Galois theory
PPT
CPSC 125 Ch 1 sec 2
PDF
On Gr-Separation Axioms
PDF
IRJET- W-R0 Space in Minimal G-Closed Sets of Type1
PDF
A STUDY ON L-FUZZY NORMAL SUBl -GROUP
Galois theory andrew hubery
#3 formal methods – propositional logic
Galois theory
CPSC 125 Ch 1 sec 2
On Gr-Separation Axioms
IRJET- W-R0 Space in Minimal G-Closed Sets of Type1
A STUDY ON L-FUZZY NORMAL SUBl -GROUP

What's hot (18)

PPT
PDF
Computational logic First Order Logic
PDF
Computational logic First Order Logic_part2
PDF
140106 isaim-okayama
PPTX
Computational logic Propositional Calculus proof system
PDF
The Number of Transitive P- Groups Of Degree P3
PDF
Formal Logic - Lesson 7 - Rules of Inference
PPTX
October 16, 2013
PDF
Formal Logic - Lesson 1 - Introduction to Logic
PPT
Regular Languages
PDF
Ac2640014009
KEY
DiffCalculus: September 10, 2012
PDF
Formal Logic - Lesson 4 - Tautology, Contradiction and Contingency
PDF
Crystallographic groups
PDF
Stability criterion of periodic oscillations in a (15)
PDF
Entrega2_MALGTN_DEFINITVA
PDF
Abstract Algebra Cheat Sheet
PPT
Logic&proof
Computational logic First Order Logic
Computational logic First Order Logic_part2
140106 isaim-okayama
Computational logic Propositional Calculus proof system
The Number of Transitive P- Groups Of Degree P3
Formal Logic - Lesson 7 - Rules of Inference
October 16, 2013
Formal Logic - Lesson 1 - Introduction to Logic
Regular Languages
Ac2640014009
DiffCalculus: September 10, 2012
Formal Logic - Lesson 4 - Tautology, Contradiction and Contingency
Crystallographic groups
Stability criterion of periodic oscillations in a (15)
Entrega2_MALGTN_DEFINITVA
Abstract Algebra Cheat Sheet
Logic&proof
Ad

Similar to PRIMES is in P (20)

PPTX
Introduction to the AKS Primality Test
PPTX
Prime and Composite Numbers
PPT
PDF
A Load-Balanced Parallelization of AKS Algorithm
PDF
Prime Numbers and Their Digital Roots
PPT
2010 3-24 cryptography stamatiou
PPTX
The Complexity Of Primality Testing
PPTX
Information and network security 34 primality
PPTX
Basics of Mathematical Cryptography
PPT
1111111111111111111111111111111111111111
DOCX
Classical Encryption Techniques: Symmetric cipher model, Substitution techniq...
PPT
ch08 modified.pptmodified.pptmodified.ppt
PDF
Heuristics for counterexamples to the Agrawal Conjecture
PPT
Crptography and network security Number theory -
PPTX
Fermat and euler theorem
PDF
Mystery_of_Primes.pdf
PPTX
Number_Theory-1 number theory notes for engineering
PPT
Set Of Primes Is Infinite - Number Theory
PPT
wilson's and fermat little theorem .ppt
Introduction to the AKS Primality Test
Prime and Composite Numbers
A Load-Balanced Parallelization of AKS Algorithm
Prime Numbers and Their Digital Roots
2010 3-24 cryptography stamatiou
The Complexity Of Primality Testing
Information and network security 34 primality
Basics of Mathematical Cryptography
1111111111111111111111111111111111111111
Classical Encryption Techniques: Symmetric cipher model, Substitution techniq...
ch08 modified.pptmodified.pptmodified.ppt
Heuristics for counterexamples to the Agrawal Conjecture
Crptography and network security Number theory -
Fermat and euler theorem
Mystery_of_Primes.pdf
Number_Theory-1 number theory notes for engineering
Set Of Primes Is Infinite - Number Theory
wilson's and fermat little theorem .ppt
Ad

More from dhruvgairola (8)

PDF
A Generic Algebraic Model for the Analysis of Cryptographic Key Assignment Sc...
PPTX
Differences bet. versions of UML diagrams.
PPTX
Beginning jQuery
PPTX
Beginning CSS.
PDF
A Theory of the Learnable; PAC Learning
PPTX
Discussion : Info sharing across private DBs
PPTX
PPTX
Potters wheel
A Generic Algebraic Model for the Analysis of Cryptographic Key Assignment Sc...
Differences bet. versions of UML diagrams.
Beginning jQuery
Beginning CSS.
A Theory of the Learnable; PAC Learning
Discussion : Info sharing across private DBs
Potters wheel

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
cuic standard and advanced reporting.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
A Presentation on Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
Per capita expenditure prediction using model stacking based on satellite ima...
Big Data Technologies - Introduction.pptx
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Assigned Numbers - 2025 - Bluetooth® Document
cuic standard and advanced reporting.pdf
Tartificialntelligence_presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
A Presentation on Artificial Intelligence
Getting Started with Data Integration: FME Form 101
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectroscopy.pptx food analysis technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation_ Review paper, used for researhc scholars

PRIMES is in P

  • 1. PRIMES is in P: A Breakthrough for Everyman F. Bornemann (based on Agarwal ’04) Dhruv Gairola Computational Complexity, Michael Soltys gairold@mcmaster.ca ; dhruvgairola.blogspot.ca October 22, 2013 Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 1 / 10
  • 2. Overview 1 Primality Testing Introduction Existing Methods 2 Contribution Intuition AKS Algorithm Time Complexity 3 Reception 4 Conclusion Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 2 / 10
  • 3. Primality Testing : Introduction Primes are greater than 1 and have no positive divisors other than 1 and itself. Non primes are composite numbers. PRIMES is the decisional problem of determining whether or not a given integer n is prime. Important in cryptography (e.g., RSA) Finding large ”random” primes. Number of primes less than x is about x / ln x. Test O(k) random k-bit numbers you will probably find a prime. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 3 / 10
  • 4. Primality Testing : Existing Methods Sieve of Eratosthenes Ancient, iterative method to generate primes between 1 and n. Simple but exponential, esp. in crypto where we are interested in large numbers. Fermats Little Theorem If p is prime, for every a coprime to p, ap−1 ≡ 1 (mod p) Try lots of a’s, if always holds p is probably prime. Carmichael numbers (rare). Rabin Miller Test Randomized, fast. Definitely composites; finds primes with high probability . PRIMES ∈ co-RP (i.e., false positives exist but no false negatives). ECPP (Elliptic curve primality proving) Result is error free but expected polynomial running time. No deterministic, polynomial time algorithm! (Miller 1976?) Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 4 / 10
  • 5. Contribution : Intuition AKS algorithm : deterministic and polynomial time. Based on generalization of Fermat’s Little Theorem. Theorem : Suppose a and p are coprime with p > 1. p is prime iff (X + a)p ≡ X p + a (mod p) X is an indeterminate variable. Formally, we have the identity (X + a)p = X p + a in the ring Z[X] of polynomials of one variable X over the finite field Z of p elements. Check different values of a, but there are p possible choices of a. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 5 / 10
  • 6. Contribution : Intuition (2) Don’t look at (X + a)p , look at remainder after division by (X r − 1) where r is coprime to a. Fewer coefficients to compare with : (X + a)p ≡ X p + a (mod X r − 1, p) i.e., mod by X r − 1 first and then mod by n. True for certain composites. Impose certain conditions, arrive at key AKS theorem. Proof is rather long, but ”simple” enough. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 6 / 10
  • 7. Contribution : AKS Algorithm AKS Algorithm (pseudocode of AKS Theorem) 1 Decide if p is a power of a natural number. If so, go to step 5. 2 Choose variables satisfying the hypotheses of the AKS theorem. 3 For a = 1, . . . , (s − 1) do the following: (i) If a is a divisor of p, go to step 5. (ii) If (X − a)p ≡ X p − a (mod X r − 1, p), go to step 5. 4 p is prime. Done. 5 p is composite. Done. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 7 / 10
  • 8. Contribution : Time Complexity ˜ Original paper : O(log 10.5 n) 10.5 n · poly (loglogn)). i.e., O(log i.e., O(log 10.5 n · (loglogn)O(1) ). ˜ Assuming Sophie Germain conjecture : O(log 6 n). A Sophie-Germain prime is a prime q such that r = 2q + 1 is also prime. Conjectured that infinitely many Sophie-Germain primes. Computation of variables in the AKS theorem becomes faster. Other improvements are no longer ”simple” to understand. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 8 / 10
  • 9. Reception Media Misleading portrayal. e.g., NYT ”quick and definitively”; WSJ ”One beautiful mind from India is putting the Internet on alert”. Scientific Community Godel Prize, Fulkerson Prize. Proposed extensions. Industry Not utilized. Variations of Rabin Miller used instead. Randomized algorithms faster with extremely low probability of error. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 9 / 10
  • 10. Conclusion Deterministic, polynomial algorithm for primality testing. Important result in complexity theory but efficient algorithms still preferred practically. Million dollar prize : Riemann hypothesis. Dhruv Gairola (McMaster Univ.) PRIMES is in P October 22, 2013 10 / 10