Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Popular topics and tags

    Shapes

    • Geometry
    • Vectors and matrices
    • Topology
    • Networks and graph theory
    • Fractals

    Numbers

    • Number theory
    • Arithmetic
    • Prime numbers
    • Fermat's last theorem
    • Cryptography

    Computing and information

    • Quantum computing
    • Complexity
    • Information theory
    • Artificial intelligence and machine learning
    • Algorithm

    Data and probability

    • Statistics
    • Probability and uncertainty
    • Randomness

    Abstract structures

    • Symmetry
    • Algebra and group theory
    • Vectors and matrices

    Physics

    • Fluid dynamics
    • Quantum physics
    • General relativity, gravity and black holes
    • Entropy and thermodynamics
    • String theory and quantum gravity

    Arts, humanities and sport

    • History and philosophy of mathematics
    • Art and Music
    • Language
    • Sport

    Logic, proof and strategy

    • Logic
    • Proof
    • Game theory

    Calculus and analysis

    • Differential equations
    • Calculus

    Towards applications

    • Mathematical modelling
    • Dynamical systems and Chaos

    Applications

    • Medicine and health
    • Epidemiology
    • Biology
    • Economics and finance
    • Engineering and architecture
    • Weather forecasting
    • Climate change

    Understanding of mathematics

    • Public understanding of mathematics
    • Education

    Get your maths quickly

    • Maths in a minute

    Main menu

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • Audiences

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Prime time

    by
    Rachel Thomas
    9 October, 2002
    09/10/2002

    Despite struggling for centuries to find a simple and efficient way to test whether a number is prime, mathematicians have been gazumped by two computer science students and their professor. Manindra Agrawal of the Indian Institute of Technology, Kanpur, and his two postgraduate students, Neeraj Kayal and Nitin Saxena, have found a quick and simple algorithm (known as the AKS algorithm) that conclusively tests for primality.

    The AKS Algorithm

    The AKS Algorithm

    Prime numbers are central to mathematics. They are the building blocks of the natural numbers - any integer can be expressed uniquely as a product of primes - and they play a crucial role in cryptography and e-commerce. The earliest known primality test is Eratosthenes' Sieve, which dates from around 240 BC. The Greek mathematician simply checked whether each integer less than the square root of n (the number to be tested) divided n. This method is straightforward but slow, as the time required increases exponentially as n increases.

    With the rise of e-commerce and the resulting importance of secure communications, identifying primes has become vital to all of us (see Safety in Numbers in Issue 21 of Plus for how primes are used in cryptography). Mathematicians already have algorithms for primality testing that are fast and correct enough of the time for all practical purposes - but up till now the choice has been between algorithms that are fast but have a small chance of giving the wrong answer, or that are correct but have a small chance of being slow. In fact there are algorithms that run faster than AKS, but the lack of a primality algorithm proven to run in polynomial time has been a thorn in mathematicians' sides.

    The complexity of an algorithm is the maximum time it takes to return an answer, expressed in terms of the number of steps required for the algorithm to run, as a function of the size of the input. A polynomial time algorithm, such as the AKS algorithm, is one where the complexity is some power of the input. In this case, the input (the number of bits needed to represent the number n being tested) is log n (base 2). The complexity of the AKS algorithm is log n12.

    The result is a "superb theoretical breakthrough" according to mathematicians in the field. And not only does it finally prove that primality testing is possible in polynomial time, but it does so using relatively simple mathematics. In contrast to other work in the field, it takes just 9 pages to prove both the correctness and the speed of the AKS algorithm.

    The elegance and simplicity of the result comes from an ingenious application of Fermat's Little Theorem:

    For any prime integer n and any integer a coprime to n, an-1 = 1 (mod n).

    What was new in this work was the way the researchers reduced the number of instances of this theorem that they needed to check (the loop in steps 3 to 10). Agrawal calls this process "lifting the polynomial" - extending correctness of the statement over a smaller number of cases to a proof which is valid for the whole domain.

    Impressive though this theoretical achievement is, it will have little practical impact, as the existing algorithms are faster and sufficiently accurate. And, of course, the harder problem of factorising a number (in polynomial time) once it is known to be composite remains unsolved. However, as Kayal and Saxena have achieved a result significant enough to qualify for a Ph.D. after just one semester, perhaps they or another group of students will surprise the mathematics world with the solution to this problem as well.

    Read more about...
    prime number
    polynomial time
    • Log in or register to post comments

    Read more about...

    prime number
    polynomial time
    University of Cambridge logo

    Plus is part of the family of activities in the Millennium Mathematics Project.
    Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

    Terms