07 September 2007

An Algorithm for Calculating Some Prime Numbers

Dana E. Edgecomb

When examining prime number sequences, at first glance it appears that they are entirely erratic. Upon further examination, I discovered that if you take the highest prime, and multiply it by the next to highest prime, then between the highest prime and the product so obtained, there is at least one prime in the sequences I examined. This suggests that there is some kind of regularity in prime number sequences.

This led me to try many possibilities to find a formula to calculate new primes. This failed miserably, but in the process I discovered an algorithm that will allow one to calculate some prime numbers. Steps 6 and 7 are optional. Sometimes those two steps will generate composite (non-prime) numbers. If you don't use those steps, then skip to step 8. The algorithm is as follows:

1. Start with a sequence of at least three prime numbers.

2. Divide the sequence into two groups of at least one number each.

3. Multiply the numbers within each group when there is more than one number.

4. Add the two group results together.

5. You now have a prime result. Repeat steps 3 and 4 for all possible permutations of the grouping.

Steps 6 and 7 are optional. They will create some primes not calculated above, but will also calculate some composite numbers.

6. Replace one prime at a time with its square.

7. Repeat steps 2 through 6 for the whole sequence.

8. You can now annex the next highest prime to the original sequence, and continue calculations from step 2, until you are exhausted.

Note: Subtracting the smaller group result from the larger group result, instead of adding, will also result in a prime.

I have calculated the following examples using all 8 steps, and marked the composite numbers calculated by steps 6 and 7:

Round 1, steps 1-5:

1 + (2 x 3) = 1 + 6 = 7

2 + (1 x 3) = 2 + 3 = 5

3 + (1 x 2) = 3 + 2 = 5

Round 1, steps 6 and 7:

12 + (2 X 3) = 1 + 6 = 7

22 + (1 X 3) = 4 + 3 = 7

32 + (1 X 2)= 9 + 2 = 11

(12 X 2) + 3 = 2 + 3 = 5

(12 X 3) + 2 = 3 + 2 = 5

(22 X 1) + 3 = 4 + 3 = 7

(22 X 3) + 1 = 12 + 1 = 13

(32 X 1) + 2 = 9 + 2 = 11

(32 X 2) + 1 = 18 + 1 = 19

Round 1, step 8:

Annexing the next highest prime to the original sequence gives the sequence 1, 2, 3, 5.


Round 2:

1 + (2 X 3 X 5) = 1 + 30 = 31

2 + (1 X 3 X 5) = 2 + 15 = 17

3 + (1 X 2 X 5) = 3 + 10 = 13

5 + (1 X 2 X 3) = 5 + 6 = 11

(1 X 2) + (3 X 5) = 2 + 15 = 17

(1 X 3) + (2 X 5) = 3 + 10 = 13

(1 X 5) + (2 X 3) = 5 + 6 = 11

(1 X 2 X 3) + 5 = 6 + 5 = 11

12 + (2 X 3 X 5) = 1 + 30 = 31

22 + (1 X 3 X 5) = 4 + 15 = 19

32 + (1 X 2 X 5) = 9 + 10 = 19

52 + (1 X 2 X 3) = 25 + 6 = 31

(12 X 2) + (3 X 5) = 2 + 15 = 17

(12 X 3) + (2 X 5) = 3 + 10 = 13

(12 X 5) + (2 X 3) = 5 + 6 = 11

(12 X 2 X 3) + 5 = 6 + 5 = 11

1 + (22 X 3 X 5) = 1 + 60 = 61

3 + (22 X 1 X 5) = 3 + 20 = 23

5 + (22 X 1 X 3) = 5 + 12 = 17

(22 X 1) + (3 X 5) = 4 + 15 = 19

(22 X 3) + (1 X 5) = 12 + 5 = 17

(22 X 5) + (1 X 3) = 20 + 3 = 23

(22 X 1 X 3) + 5 = 12 + 5 = 17

(22 X 3 X 5) + 1 = 60 + 1 = 61

1 + (2 X 32 X 5) = 1 + 90 = 91

2 + (1 X 32 X 5) = 2 + 45 = 47

5 + (1 X 2 X 32) = 5 + 18 = 23

(32 X 1) + (2 X 5) = 9 + 10 = 19

(32 X 2) + (1 X 5) = 18 + 5 = 23

(32 X 5) + (1 X 2) = 45 + 2 = 47

(32 X 1 X 2) + 5 = 18 + 5 = 23

1 + (52 X 2 X 3) = 1 + 150 = 151

2 + (52 X 1 X 3) = 2 + 75 = 77

3 + (52 X 1 X 2) = 3 + 50 = 53

(52 X 1) + (2 X 3) = 25 + 6 = 31

(52 X 2) + (1 X 3) = 50 + 3 = 53

(52 X 3) + (1 X 2) = 75 + 2 = 77


Annexing the next highest prime to the original sequence (round 3):

1 + (2 X 3 X 5 X 7) = 1 + 210 = 211

2 + (1 X 3 X 5 X 7) = 2 + 105 = 107

3 + (1 X 2 X 5 X 7) = 3 + 70 = 73

5 + (1 X 2 X 3 X 7) = 5 + 42 = 47

7 + (1 X 2 X 3 X 5) = 7 + 30 = 37

(1 X 2) + (3 X 5 X 7) = 2 + 105 = 107

(1 X 3) + (2 X 5 X 7) = 3 + 70 = 73

(1 X 5) + (2 X 3 X 7) = 5 + 42 = 47

(1 X 7) + (2 X 3 X 5) = 7 + 30 = 37

(1 X 2 X 3) + (5 X 7) = 6 + 35 = 41

(1 X 2 X 5) + (3 X 7) = 10 + 21 = 31

(1 X 3 X 5) + (2 X 7) = 15 + 14 = 29

(1 X 3 X 7) + (2 X 5) = 21 + 10 = 31

(2 X 3) + (1 X 5 X 7) = 6 + 35 = 41

(2 X 5) + (1 X 3 X 7) = 10 + 21 = 31

(2 X 7) + (1 X 3 X 5) = 14 + 15 = 29

12 + (2 X 3 X 5 X 7) = 1 + 210 = 211

22 + (1 X 3 X 5 X 7) = 4 + 105 = 109

32 + (1 X 2 X 5 X 7) = 9 + 70 = 79

52 + (1 X 2 X 3 X 7) = 25 + 42 = 67

72 + (1 X 2 X 3 X 5) = 49 + 30 = 79

(12 X 2) + (3 X 5 X 7) = 2 + 105 = 107

(12 X 2 X 3) + (5 X 7) = 6 + 35 = 41

(12 X 2 X 5) + (3 X 7) = 10 + 21 = 31

(12 X 2 X 7) + (3 X 5) = 14 + 15 = 29

(12 X 2 X 3 X 5) + 7 = 30 + 7 = 37

(12 X 3) + (2 X 5 X 7) = 3 + 70 = 73

(12 X 5) + (2 X 3 X 7) = 5 + 42 = 47

(12 X 7) + (2 X 3 X 5) = 7 + 30 = 37

1 + (22 x 3 x 5 x 7) = 1 + 420 = 421

3 + (22 x 1 X 5 x 7) = 3 + 140 = 143

5 + (22 x 1 x 3 x 7) = 5 + 84 = 89

7 + (22 x 1 x 3 x 5) = 7 + 60 = 67

(22 X 1) + (3 X 5 X 7) = 4 + 104 = 109

(22 X 3) + (1 X 5 X 7) = 12 + 35 = 47

(22 X 5) + (1 X 3 X 7) = 20 + 21 = 41

(22 x 7) + (1 x 3 x 5) = 28 + 15 = 53

(22 X 1 X 3) + (5 X 7) = 12 + 35 = 47

(22 X 1 X 5) + (3 X 7) = 20 + 21 = 41

(22 x 1 x 7) + (3 X 5) = 28 + 15 = 43

(22 X 3 X 5) + (1 X 7) = 60 + 7 = 67

(22 x 3 x 7) + (1 x 5) = 84 + 5 = 89

1 + (32 x 2 x 5 x 7) = 1 + 630 = 631

2 + (32 x 1 x 5 x 7) = 2 + 315 = 317

5 + (32 x 1 x 2 x 7) = 5 + 126 = 131

7 + (32 x 1 x 2 x 5) = 7 + 90 = 97

32 + (1 X 2 X 5 X 7) = 9 + 70 = 79

(32 X 1) + (2 x 5 x 7) = 9 + 70 = 79

(32 x 2) + (1 x 5 x 7) = 18 + 35 = 53

(32 x 5) + (1 x 2 x 7) = 45 + 14 = 59

(32 x 7) + (1 x 2 x 5) = 63 + 10 = 73

(32 x 1 x 2) + (5 x 7) = 18 + 35 = 53

(32 X 1 X 5) + (2 X 7) = 45 + 14 = 59

(32 x 1 x 7) + (2 x 5) = 63 + 10 = 73

1 + (2 x 3 x 52 x 7) = 1 + 1050 = 1051

2 + (1 x 3 x 52 x 7) = 2 + 525 = 527

3 + (1 x 2 x 52 x 7) = 3 + 350 = 353

7 + (1 x 2 x 3 x 52) = 7 + 150 = 157

52 + (1 x 2 x 3 x 7) = 25 + 42 = 67

(52 x 1) + (2 x 3 x 7) = 25 + 42 = 67

(52 x 2) + (1 x 3 x 7) = 50 + 21 = 71

(52 x 3) + (1 x 2 x 7) = 75 + 14 = 89

(52 x 7) + (1 x 2 x 3) = 175 + 6 = 181

(52 x 1 x 2) + (3 x 7) = 50 + 21 = 71

(52 x 1 x 3) + (2 x 7) = 75 + 14 = 89

(52 X 1 X 7) + (2 x 3) = 175 + 6 = 181

1 + (72 x 2 x 3 x 5) = 1 + 1470 = 1471

2 + (72 x 1 x 3 x 5) = 2 + 735 = 737

3 + (72 X 1 X 2 X 5) = 3 + 490 = 493

5 + (72 X 1 X 2 X 3) = 5 + 294 = 299 [composite]

72 + (1 X 2 X 3 X 5) = 49 + 30 = 79

(72 X 1) + (2 X 3 X 5) = 49 + 30 = 79

(72 x 2) + (1 X 3 X 5) = 98 + 15 = 113

(72 x 3) + (1 X 2 X 5) = 147 + 10 = 157

(72 X 5) + (1 X 2 X 3) = 245 + 6 = 251

(72 X 1 X 2) + (3 X 5) = 98 + 15 = 113

(72 X 1 X 3) + (2 X 5) = 147 + 10 = 157

(72 X 1 X 5) + (2 X 3) = 245 + 6 = 251

(72 X 2 X 3) + (1 X 5) = 294 + 5 = 299 [composite]

(72 X 2 X 5) + (1 X 3) = 490 + 3 = 493

(72 X 3 x 5) + (1 x 2) = 735 + 4 = 739

If you eliminate the duplicates and put the primes calculated this way into a series, there are some gaps of prime numbers that are not calculated by this algorithm. Perhaps there is a modification of these rules that would calculate all prime numbers in a series.

I would categorize this as a “dynamic equation”, as it changes with each calculation but according to prescribed rules. Dynamic equations could open up a whole new branch of mathematics.