Is Trial Division Primality Check Considered in Polynomial Time?

  • Thread starter Thread starter mourinho123
  • Start date Start date
  • Tags Tags
    Division trial
Click For Summary
SUMMARY

The discussion centers on the classification of the trial division primality check algorithm in relation to polynomial time complexity. While trial division operates in O(n^(1/2)), it is not considered polynomial time due to the input size being O(log N). The running time is exponential in terms of the input size, which is a critical distinction. In contrast, the AKS primality test, which is a more efficient algorithm, operates in O(n^6) time, with conjectured improvements to O(n^4).

PREREQUISITES
  • Understanding of algorithm time complexity, specifically Big O notation.
  • Familiarity with primality testing algorithms, including trial division and AKS.
  • Knowledge of input size representation in algorithms, particularly O(log N).
  • Basic concepts of computational complexity theory.
NEXT STEPS
  • Research the AKS primality test and its time complexity improvements.
  • Explore advanced primality testing algorithms beyond trial division.
  • Study the implications of input size on algorithm performance.
  • Learn about other polynomial time algorithms and their classifications.
USEFUL FOR

Computer scientists, algorithm developers, and students studying computational complexity who seek to understand the nuances of primality testing and time complexity classifications.

mourinho123
Messages
1
Reaction score
0
Greetings,

This is very simple, and obviously I'm missing something trivial, but I still don't get it.

An algorithm is said to run in polynomial time if it runs in O(n^K) time.

That's why dijkstra for example, who runs in O(V^2), runs in polynomial time.

That said, my doubt is the following:
If a brute-force trial division primality check algorithm, runs in O(n^(1/2)), why it isn't considered in polynomial time?

Thanks beforehands,
Mourinho
 
Physics news on Phys.org
The running time of an algorithm is usually expressed in terms of the size of the input data.

If you want to test N for primality, the amount of data you need to need to give your algorithm is O(log N). (e.g. if your algorithm works in base 10, the size of the input is the number of decimal digits it takes to write N, so the input size is (log N) / log(10))

So, the size of the input is (log N), and the amount of work necessary is N^(1/2)... which is exponential in the size of the input.



(Of course, it would be accurate to say that the running time is polynomial in N)
 
The AKS primality test takes O(n6) time* to check if an n-bit number is prime. Trial division takes O(2n/2).

* The exponent depends on the version used. I think the original was O(n12) time and the best versions so far are conjectured to run in O(n4) time.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 65 ·
3
Replies
65
Views
8K
  • · Replies 25 ·
Replies
25
Views
902
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K