To my surprise, there IS a formula that will unfailing generate primes and only primes. The formula is:
(2 n! mod(n+1)) + 2
Most of the time it generates 2, but the rest of the times it gives a bona fide prime number, and has the ability to generate ALL the prime numbers. It's just not very handy for generating very large prime numbers.
For those not familiar with the mod() function, after computing n! and doubling it, divide the number by (n+1), and get the remainder. Then add 2 to the remainder. You have a prime number. Every time. Try it on your calculator, hope you got one that does n! for you.
2007-01-03 08:57:27
·
answer #1
·
answered by Scythian1950 7
·
0⤊
0⤋
There is no general formula for prime numbers.
Professional cryptographers and internet security providers also need to generate prime numbers, and they just do it by generating random numbers and testing them to see if they are prime. For primes up to 200 digits, there are enough schoolboy-level shortcuts which can be used to speed this up to the point where it is not necessary to do anything more clever.
Chris Caldwell's Prime Pages are the best resource on the whole net for this sort of thing. See the web site below.
2007-01-03 01:12:58
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
The only formula guaranteed to generate prime numbers is as follows:
A prime p is called primorial or prime-factorial if it has the form p = n# ± 1 for some number n, where n# stands for the product of all the primes ≤ n.
There are various other common forms of primes, but these formulas will only generate prime numbers for certain values of n. Other values generate non-prime numbers.
A prime is called factorial if it is of the form n! ± 1. The first factorial primes are:
n! − 1 is prime for n = 3, 4, 6, 7, 12, 14, 30, 32, 33, 38, 94, 166,...
n! + 1 is prime for n = 0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154...
Primes of the form 2^n − 1 are known as Mersenne primes, while primes of the form 2^(2^n) + 1 are known as Fermat primes. Prime numbers p where 2p + 1 is also prime are known as Sophie Germain primes. The following list is of other special types of prime numbers that come from formulas:
Wieferich primes,
Wilson primes,
Wall-Sun-Sun primes,
Wolstenholme primes,
Unique primes,
Newman-Shanks-Williams primes (NSW primes),
Smarandache-Wellin primes,
Wagstaff primes, and
Supersingular primes.
2007-01-03 00:57:40
·
answer #3
·
answered by ? 4
·
2⤊
2⤋
I dont think there is any formula for generating prime numbers.
For relatively smaller numbers, there is a method called Erastothenus sieve (google it if u want to know abt it) or something to generate prime numbers. But for large numbers, i dont know any.
2007-01-03 00:53:15
·
answer #4
·
answered by ? 3
·
0⤊
2⤋
There is no known formula as of yet. I'm sure mathematecians all over the world are trying to come up with one right now. My math teacher said someone will probably come up with one in my life time (I'm a college sophomore). Whoever does it is up for a lot of fame and possibly money.
2007-01-03 00:51:57
·
answer #5
·
answered by Anonymous
·
1⤊
1⤋
No.
If it were only that easy!
The focus tends be be on *testing* whether numbers are prime.
2007-01-03 05:00:07
·
answer #6
·
answered by Jerry P 6
·
0⤊
0⤋