.physics
- 15
- 0
Is there any mathematical formula to predict / generate / or test the prime number??
The discussion centers around the existence and methods for predicting, generating, or testing prime numbers. It includes various mathematical approaches, algorithms, and specific cases like Mersenne primes.
Participants express various methods for testing primality, but there is no consensus on a single best approach. Multiple competing views on the efficiency and applicability of different algorithms and formulas remain unresolved.
Some methods discussed may have limitations regarding their computational feasibility for very large numbers, and the effectiveness of different algorithms is not universally agreed upon.
CRGreathouse said:Sure there are primalitry tests. To see if an integer n is prime, calculate [itex]\pi(n)-\pi(n-1)[/itex]. The result is 1 if an only if the number is prime.
hamster143 said:you're better off doing what HallsofIvy proposes and trying to divide by all primes up to [itex]\sqrt{n}[/itex].
HallsofIvy said:Certainly there exist a formula for testing form prime numbers:
To determine whether n is a prime number, divide it by every prime less than or equal to [itex]\sqrt{n}[/itex]. If none of those divides n, then n is prime.