No of primes less than a given number

  • Thread starter srijithju
  • Start date
  • Tags
    Primes
In summary, the conversation discusses the problem of proving if N=NP and its implications on finding prime numbers in polynomial time. The concept of NP and P complexity classes is also touched upon. The conversation ends with a discussion on the difficulty of finding the number of primes less than N. The speaker also suggests reading a textbook on computational complexity or taking a course for a deeper understanding of the topic.
  • #1
srijithju
57
0
After reading 1 of the posts in this forum , I had a look at the millenium problems .
There I saw the problem of proving if N=NP .

I really did not understand what is NP and what is P ( I checked the Wikipedia link but this got me even more confused ... It talked of a non deterministic Turing machine whatever that is )

This is my doubt :
There exists an algorithm (AKS algorithm) which is able to calculate if a number is prime in with polynomial complexity.

Now if it is proved that N=NP , does that imply that you can also develop an algorithm to find all primes less than or equal to a prime in polynomial time ?

Could someone suggest some literature where I can read about what NP / P complexity classes are. Also I am not sure of what exactly is the meaning of polynomial complexity also with respect to treatment of integers ( for eg. checking if N is prime)


This is my understanding of complexity of an algo:
Complexity refers to number of calculations to be done by a computer to reach the result ( find the solution) expressed as a function of the size of the input.

Now to check if N is prime we would first have to express N as a binary number. Now in the process of checking if it is prime we may have to add / multiply / divide these numbers . What we be the complexities of these individual steps ..
To add 2 numbers we get answer in 1 step ( 1 clock cycle of ALU of computer) if the size of number is within the CPU register width , but if it exceeds this width we need more cycles depending on how large the number is . Similarly for multiplication and division . So how do we calculate the actual complexity of a specific problem ?
Please help
 
Mathematics news on Phys.org
  • #2
You can think of NP as the class of problems whose solutions can be VERIFIED in polynomial time. ie, if I ask you to factor N, and you give me p and q, I can multiply them easily and check whether N=pq. While P is the class of problems whose solutions can be COMPUTED in polynomial-time, like sorting N numbers.

Even if P=NP, there might not be a polynomial-time algorithm that will compute the number of primes less than N exactly. But I think this is due to our lack of understanding of the prime numbers rather than complexity. So this would be a problem in number theory, not computational complexity.

Any textbook on "computational complexity" will do. But I suggest taking a course if you really want to learn about it.

If you just want a superficial understanding of the millennium problems (it would take a lot of math to truly understand any of them), read http://www.chapters.indigo.ca/books...ch+Books:+%27devlin+the+millenium+problems%27
 
Last edited:
  • #3
Thanks a lot for the reply ...

Dragonfall said:
Even if P=NP, there might not be a polynomial-time algorithm that will compute the number of primes less than N exactly. But I think this is due to our lack of understanding of the prime numbers rather than complexity. So this would be a problem in number theory, not computational complexity.

yes I can see that maybe the reason we cannot calculate all primes < N in polynomial time is probably due to our lack of understanding of number theory, but what I mean to as is if P=NP , then does not that mean that theoretically an algo exists that can compute primes < N in polynomial time , though we are unaware of such an algo.


Now regarding the explanation you gave of a P problem and an NP problem -

So if we consider the problem of finding all the prime numbers then that means :

a) This problem is most certainly a NP problem because we already know of an algorithm that can verify a certain solution ( i.e. can check if a given number is prime) in polynomial time.
b) But we are not sure if the problem is P .

But considering this problem - is this not a counter example to showing P=NP , because we know there are infinitely many primes so how are we supposed to calculate an infinite number of solutions in polynomial time ? - or is it that all the prime numbers can be expressed by some formula ( which at present we do not know of) , and it is enough to find this formula in polynomial time .
 
  • #4
srijithju said:
yes I can see that maybe the reason we cannot calculate all primes < N in polynomial time is probably due to our lack of understanding of number theory, but what I mean to as is if P=NP , then does not that mean that theoretically an algo exists that can compute primes < N in polynomial time , though we are unaware of such an algo.

Do you mean compute a prime < N, compute all primes < N, or the number of primes < N?

srijithju said:
So if we consider the problem of finding all the prime numbers then that means :

a) This problem is most certainly a NP problem because we already know of an algorithm that can verify a certain solution ( i.e. can check if a given number is prime) in polynomial time.

"Finding all the primes" less than N is certainly not an NP problem, because there's no way you can verify all the approx. N/log N many primes in polynomial time. This problem isn't even in PSPACE.

However, finding a prime less than N is NP. In fact, it's most likely P. However since this problem isn't NP-hard, the existence of a polynomial-time algorithm for solving it does not mean P=NP.

I don't know how hard finding the number of primes less than N is.
 
Last edited:
  • #5
Dragonfall said:
I don't know how hard finding the number of primes less than N is.

The best known algorithm is exponential -- time ~ n^(1/2 + eps). I don't think there's any hope for finding a polynomial algorithm.
 
  • #6
CRGreathouse said:
The best known algorithm is exponential -- time ~ n^(1/2 + eps). I don't think there's any hope for finding a polynomial algorithm.

Do you mean (1/2+eps)^n?

There might not be a polynomial algorithm to find the exact number, but it can be approximated very well -- the prime number theorem, for example -- by polynomial algorithms.

I don't know where this problem sits in the hierarchy, either.
 

1. What is the formula for finding the number of primes less than a given number?

The formula for finding the number of primes less than a given number is known as the Prime Counting Function or Pi(x) function, where x is the given number. It is defined as the number of primes less than or equal to x. There is no known simple formula for this function, but there are efficient algorithms that can calculate its value.

2. Is there a limit to the number of primes less than a given number?

There is no known limit to the number of primes less than a given number. As we continue to search for larger and larger primes, we are constantly finding new ones. However, the density of primes decreases as the numbers get larger, making it more difficult to find new primes.

3. What is the largest known prime number?

As of 2021, the largest known prime number is 2^82,589,933 − 1, which has over 24 million digits. It was discovered in December 2018 by the Great Internet Mersenne Prime Search (GIMPS) project.

4. Can a perfect number have an odd number of prime factors?

No, a perfect number can only have an even number of prime factors. This is because a perfect number is defined as a number that is equal to the sum of its proper divisors (numbers that divide evenly into it). If there were an odd number of prime factors, the sum of the proper divisors would also be odd, making it impossible for the number to be equal to it.

5. How can the number of primes less than a given number be used in cryptography?

The number of primes less than a given number is used in cryptography for generating large prime numbers that are used as the basis for encryption and decryption algorithms. These prime numbers are essential in creating secure communication channels and protecting sensitive information. The larger the number of primes available, the more difficult it is for hackers to break the encryption.

Similar threads

Replies
1
Views
750
  • General Math
3
Replies
96
Views
10K
  • General Math
Replies
13
Views
1K
  • General Math
Replies
12
Views
952
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
934
  • Programming and Computer Science
Replies
14
Views
2K
  • General Math
Replies
16
Views
3K
Replies
12
Views
928
Replies
3
Views
235
Back
Top