Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
Formula for primes
In number theory, a formula for primes is a formula generating the prime numbers, exactly and without exception. Formulas for calculating primes do exist; however, they are computationally very slow. A number of constraints are known, showing what such a "formula" can and cannot be.
A simple formula is
for positive integer , where is the floor function, which rounds down to the nearest integer. By Wilson's theorem, is prime if and only if . Thus, when is prime, the first factor in the product becomes one, and the formula produces the prime number . But when is not prime, the first factor becomes zero and the formula produces the prime number 2. This formula is not an efficient way to generate prime numbers because evaluating requires about multiplications and reductions modulo .
In 1964, Willans gave the formula
for the th prime number . This formula reduces to
that is, it tautologically defines as the smallest integer for which the prime-counting function is at least . This formula is also not efficient. In addition to the appearance of , it computes by adding up copies of ; for example,
The articles What is an Answer? by Herbert Wilf (1982) and Formulas for Primes by Underwood Dudley (1983) have further discussion about the worthlessness of such formulas.
A shorter formula based on Wilson's theorem was given by J. P. Jones in 1975, using as a function:
Hub AI
Formula for primes AI simulator
(@Formula for primes_simulator)
Formula for primes
In number theory, a formula for primes is a formula generating the prime numbers, exactly and without exception. Formulas for calculating primes do exist; however, they are computationally very slow. A number of constraints are known, showing what such a "formula" can and cannot be.
A simple formula is
for positive integer , where is the floor function, which rounds down to the nearest integer. By Wilson's theorem, is prime if and only if . Thus, when is prime, the first factor in the product becomes one, and the formula produces the prime number . But when is not prime, the first factor becomes zero and the formula produces the prime number 2. This formula is not an efficient way to generate prime numbers because evaluating requires about multiplications and reductions modulo .
In 1964, Willans gave the formula
for the th prime number . This formula reduces to
that is, it tautologically defines as the smallest integer for which the prime-counting function is at least . This formula is also not efficient. In addition to the appearance of , it computes by adding up copies of ; for example,
The articles What is an Answer? by Herbert Wilf (1982) and Formulas for Primes by Underwood Dudley (1983) have further discussion about the worthlessness of such formulas.
A shorter formula based on Wilson's theorem was given by J. P. Jones in 1975, using as a function: