Demystify the Prime Number Sequence

This work is licensed by its author, Gary Croft, under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

"My general view of mathematics is that most of the complicated things we learn have their origins in very simple examples and phenomena." – Dr. Richard Evan Schwartz, Chancellor's Professor of Mathematics, Brown University

"Everything should be made as simple as possible, but not simpler." – Albert Einstein

"Seek simplicity and distrust it." – Alfred North Whitehead

This site was created to explore a deterministic algorithm and geometry, in the form of a spiral sieve, that reveals the eight factorization progressions that intertwine like an octal helix and ultimately determine the distribution of prime numbers (defined as positive integers greater than 1 that are only divisible by 1 and themselves–the first three being 2, 3 and 5).

Hidden deep within the Prime Spiral Sieve, a variant form of modulo 30 wheel factorization, are revealed mysteriously beautiful symmetries, profound in their implications. Although labeled a "sieve," it's more than that.
It not only serves as an efficient prime number sieving algorithm that accounts for *all* prime numbers ≥ 7 (as opposed to a probabilistic "almost all"), but it also demonstrates how prime numbers are distributed within a radial geometry that effectively defragments the
Ulam Spiral and ultimately leads us to "the theory of everything." This domain,
once fathomed, reveals itself to be a beautiful mathematical object in and of itself. The real power of this geometry becomes
evident when we triple it dimensionally and explore modulo 90's fundamental factorization powers at the digital root level, culminating
in the Magic Mirror Matrix, a 'calculatory geometry' that serves as a prime factorization sequencer
accounting for the first 1000 prime numbers, *exactly*, and ultimately all prime numbers >5.

The math required to understand what follows, elementary arithmetic and geometry, has been mastered by most high school students.
For the sake of universal accessibility this is for the most part a *narrative* approach to the subject, analogous to "writing
through the curriculum." Testimony supporting this 'languaging' of math comes from Stephen Hawking in his *Brief History of Time:
A Reader's Companion* (1992), where he states: "Equations are necessary if you're doing accountancy, but they are the boring part
of mathematics. Most of the interesting ideas can be conveyed by words or pictures." [Some equations, of course, are beautiful in their
own right, as Dr. Hawking would no doubt acknowledge. We're offering an alternative approach requiring minimal mathematical knowledge that can
nonetheless bring insight and aesthetic pleasure.]

What follows is a mixture of well known fact and conjecture (the latter so labeled) informed by more than two decades of heuristic
experimentation complemented by research. If you're seeking rigorous proofs here, you'll be disappointed. But if your intent is to better
*understand* how the sequence of prime numbers is constructed, read on. Through words, illustrations and elementary arithmetic,
we'll demonstrate how the prime number sequence is the result of a deterministic process involving no randonmess whatsoever.

If this site "proves" anything, it's that those with only an elementary education in mathematics can have direct access to the beautiful symmetries encompassing algorithmic order embedded within the seeming chaos of the prime number distribution and related patterns. It's hard to imagine a presumably enlightened "Spirit of the Universe" barring the vast majority of intelligent beings who haven't pursued higher mathematics a measure of insight into the profound mystery "curled up" in the roots of the number universe. After all, the experience is exhilarating, if not spiritualizing.

To date this site has attracted more than 25,400 "absolute unique visitors" (Google Analytics speak) from 168 countries. Scores have
returned repeatedly, and not one has offered counter-examples. From a hermeneutic perspecitve, the patterns explored herein speak for themselves ...*Res ipsa loquitur ...*

[Note: Nine of the sequences explored on this site have been published by the author on the *Online Encyclopedia of Integer Sequences*:

A227863: Numbers congruent to {1,49} mod 120.

A227896: Digital root of Fibonacci numbers indexed by natural numbers not divisible by 2, 3 or 5.

A230462: Numbers congruent to {1, 11, 13, 17, 19, 29} mod 30.

A232878: Twin prime pairs which sum to perfect squares.

A232880: Twin primes with digital root 2 or 4.

A232881: Twin primes with digital root 5 or 7.

A232882: Twin primes with digital root 8 or 1.

A233766: Digital root of Lucas numbers indexed by natural numbers not divisible by 2, 3 or 5.

A230113: Digital root of Fibonacci plus Lucas digital root indexed by numbers not divisible by 2, 3 or 5.

Also note that an M.I.T. licensed (Python) Prime Factorization Tool compared seven prime number generator algorithms, and the programmer deemed the Croft Spiral (aka Prime Spiral Sieve) the 'fastest and most efficient' of those tested. Quoting the programmer, "The fastest method, Croft, is over 1000 times faster than the slowest."]

The genesis of most if not all repeating prime number patterns described in the mathematics literature, e.g., Twin Primes, Cullen Primes,
Chen Primes, Sexy Primes, Cousin Primes, Sophie Germain Primes, Siamese Primes ... the list goes on and on ... can be readily deciphered
using the Prime Spiral Sieve as an analytical tool employing modular arithmetic
(and specifically, modulo 30 relationships). Here are two examples supporting this claim, i.e. using this sieve to analyze and predict
Siamese Primes (n^{2} -2 and n^{2} +2 are primes) and
Sophie Germain Primes (p and 2p+1 are primes), keeping in mind that these will make more
sense after you've read what follows.

The most obvious of these repeating prime patterns are the three Twin Prime Distribution Channels, described at length on this site. These and all other such repeating–albeit intermittent and seemingly random–patterns are fundamentally sub-patterns of the set of natural numbers not divisible by 2, 3 or 5 when arrayed in 8 dimensions, whether in a matrix or spiral form. The illusion of randomness results from the overlapping sequences of the eight algorithmic "chord progressions" that factorize the domain. We will be discussing these progressions when we get to prime factorization.

The foundation and key to the array populating the sieve are the 8 integers we've dubbed "prime roots." These 8 foundational numbers
(1, 7, 11, 13, 17, 19, 23 and 29) are arrayed in the first inner rotation of the sieve (or, alternatively, the first row of an 8-column matrix).
These are the first 8 integers of the set of natural numbers not divisible by 2, 3 or 5, which by definition includes (and *only* includes)
1 and all primes ≥ 7 and their multiples (and, as you'll see below, it's conjectured that the entire set can be generated by a simple expression involving 2, 3 and 5).

[Note: A mathematician might describe this sequence (in modular 30 terms) as: 30n+1, 30n+7, 30n+11, 30n+13, 30n+17, 30n+19, 30n+23, 30n+29, or alternatively as "numbers congruent to {1,7,11,13,17,19,23,29} modulo 30," thus sieving only ϕ(m)/m = 8/30 or 26.66% of natural numbers. Also note that if you plug the number 30 into Euler's totient function, phi(n): phi(30)= 8, with the 8 integers (known as totatives) smaller than and having no factors in common with 30 being: 1, 7, 11, 13, 17, 19, 23 and 29, i.e., what are called "prime roots" above. Thirty is the largest integer with this property.]

The integer **30**, product of the first three prime numbers (2, 3 and 5), and thus a primorial, plays a powerful role organizing
the array's perfect symmetry, viz., in the case of the 8 prime roots:

**1+29=30; 7+23=30; 11+19=30;** and **13+17=30.**

In *The Number Mysteries* well-known mathematician Marcus Du Sautoy writes: "In the world of mathematics, the numbers 2, 3, and 5
are like hydrogen, helium, and lithium. That's what makes them the most important numbers in mathematics." Although 2, 3 and 5 are the only prime numbers not included in the domain under discussion, they are nonetheless integral to it: First of all, they sieve out roughly 3/4ths of all natural numbers, leaving only those nominally necessary to construct a geometry within which prime numbers can be optimally arrayed. The remaining 26.66%
(to be a bit more precise) constituting the array can be constructed with an elegantly simple interchangeable expression that incorporates the
first three primes. It's conjectured that this expression can be configured (albeit by trial-and-error) to produce **all** (*and only*) the numbers in the array (and their negatives):** x ^{n}y^{n} ± z^{n}** where x=2, y=3 and z=5. Thus:

The Prime Spiral Sieve possesses remarkable structural and numeric symmetries. For starters, the intervals between the prime roots (and every subsequent row or rotation of the sieve) are perfectly balanced, with a period 8 difference sequence of: {6, 4, 2, 4, 2, 4, 6, 2}. The entire domain can thus be defined as **1 {+6 +4 +2 +4 +2 +4 +6 +2} {repeat ... ∞}**. As we've already suggested, the number 30 figures large in our modulo 30 domain. The Prime Spiral Sieve is Archimedean in that the separation distance between turns equals 30, ad infinitum. The first two rotations increment as follows:

Interestingly, the sum of the 2nd rotation = 360. Is it coincidental that the product of the first three primorials, 2, 6 and 30 = 360? Or is it coincidental that when you multiply the first five Fibonacci numbers in sequence, you produce 1, 2, 6 and 30? And, speaking of the Fibonacci number sequence, there is symmetry mirroring the above in the relationship between the terminating digits of Fibonacci numbers and their index numbers equating to members of the array populating the Prime Spiral Sieve:

Remarkably, the sequence of Fibonacci terminating digits indexed to the prime roots, 13,937,179 (see graphic, above), is a prime number and a member of a prime pair (with 13,937,177), though, if you're curious, not a reversible prime (although the reversal is a semi-prime: 9,461 * 10,271 = 97,173,931, and you'll note that both its prime factors have two combinations summing to 10). In addition, 13,937,179 when added to its reversal 97,173,931 = 111,111,110 (in strict digital root terms, the sum is 11,111,111) and the entire repeating (and palindromic) Fibo sequence end-to-end (equivalent to two rotations around the sieve) gives you this equivalency: 1,393,717,997,173,931 ≡ 11,111,111 (mod 111,111,110)... (and interestingly, 11,111,111 * 111,111,110 = 1234567876543210 and 111,111,110/11,111,111 = 10). Also 1,393,717,997,173,931 is divisible by the repunits 11 and 1,111 and 11,111,111.

Echoing the Fibonacci patterns just described, the terminating digits of the *prime roots* (17,137,939), when added to *their*
reversal (93,973,171) = 111,111,110. And, when you connect the prime root terminating digit sequence to its reversal,
the entire palindromic sequence end-to-end produces this: 1,713,793,993,973,171 ≡ 111,111,111 (mod 111,111,110)
[And in this case, 111,111,111 * 111,111,110 = 12345678876543210.]. And if that isn't enough, 1,713,793,993,973,171 is *also* divisible
by the repunits 11 and 1,111 and 11,111,111.

Well, not quite enough, because there's yet another related dimension of symmetry: The terminating digits of the prime root
*angles* (24,264,868; see illustration of Prime Spiral Sieve) when added to *their*
reversal (86,846,242) = 111,111,110, not to mention this sequence possesses symmetries that dovetail perfectly with the prime root and
Fibo sequences, including the fact that when it is connected to its reversal (giving us 2,426,486,886,846,242), it's divisible by the
repunits 11 and 1,111 and 11,111,111.

And when you combine the terminating digit symmetries described above, capturing three rotations around the sieve in their actual sequences, you produce the ultimate combinatorial symmetry:

Here's yet another fascinating dimension of symmetry: the pattern of 9's created by decomposing and summing either the digits of
Fibonacci numbers indexed to the first two rotations of the spiral (a palindromic pattern {1393717997173931} that repeats every 16 Fibo
index numbers) or, similarly, decomposing and summing the prime root angles. The decomposition works as follows (in digit sum arithmetic
this would be termed summing to the digital root): F_{17} (the 17th Fibonacci number) = 1597 = 1 + 5 + 9 + 7 = 22 = 2 + 2 = 4:

Another dimension of symmetry involves the terminating digits of the prime roots and their angles: those paired with like terminating digits being separated by 120°: 1(12°) and 11(132°) ... 13(156°) and 23(276°) ... 7(84°) and 17(204°) ... 19(228°) and 29(348°). Another consideration with regard to terminating digits, is that one can easily construct, by combining all numbers with the same terminating digits, a four-fold arithmetic progression in increments of +10 and +20, starting with 1, 7, 13 and 19. Thus, combining 1(12°) and 11(132°) gives us: 1, 11, 31, 41, 61, 71, 91, [+10+20] ... n; combining 7(84°) and 17(204°) gives us 7, 17, 37, 47, 67, 77, 97, [+10+20] ... n; combining 13(156°) and 23(276°) gives us 13, 23, 43, 53, 73, 83, 103, [+10+20] ... n; and, combining 19(228°) and 29(348°) gives us 19, 29, 49, 59, 79, 89, 109, [+10+20] ...n. Looking at the array in this configuration, however, has borne no fruit.

As fascinating as the symmetries examined above may be, they are but a prelude to the beautiful patterns we'll explore when we discuss digital root sequencing and the Trinity of Triangles and Magic Squares rooted in Vedic Arithmetic that drive factorization algorithms within this domain. And, finally, if you want to jump ahead and view the most stunning symmetrical object found on this site, check out the Magic Mirror Matrix that maps factorizatons at the digital root level and accounts for the first 1000 prime numbers–exactly.

Around the perimeter of the spiral sieve shown below you'll note that the 8 radii are labeled in relation to their modulo 30 prime roots, i.e., 1(12°); 7(84°); 11(132°); 13(156°); 17(204°); 19(228°); 23(276°) and 29(348°). These relate to the fact that the circle is segmented into 30 equal sectors or radii separated by 12° (30*12°=360°), although only the eight radials that are the focus of this study are shown.

This sieve "exposes" the twin primes, aligning as they do along three distinct "distribution channels." One obvious implication, is that those numbers in the array with mod 30,7 (radial angle 84°) and mod 30,23 (radial angle 276°) can be excluded as twin prime candidates (and, by definition, all prime numbers distributed along these two diagonals. with the exception of 7, which is twinned with 5, will be what are known as "isolated primes"). Later we explain how twin prime candidates can be segregated from all other positive integers and be partitioned into three columnar sets covertly aligned by the first three prime numbers (encoded in angles).

The array is rooted in the first three prime numbers: 2, 3 and 5 and their product, 30, the 3rd primorial. This array reveals that the first three primes play a very special role in creating the symmetrical geometries that align the distribution of all subsequent prime numbers, thus distinguishing them from all other primes. Primes 2, 3 and 5 are like 8-legged spiders assigned to spin the beautiful spiraling web in which the remaining prime numbers are arrayed along assigned threads. (For a detailed listing of Number 30's attributes, plus reference links click here: The Number 30).

It is conjectured that all (and only) the numbers in this array (and their negatives) can be derived using the
interchangeable expression incorporating the first three prime numbers, 2, 3 and 5, where x=2, y=3 and z=5.
Thus: ** x ^{n}y^{n} ± z^{n}**,

All prime numbers (with the exception of 2, 3 and 5) are distributed along 8 diagonals in intervals of 30, starting with "prime roots": 1, 7, 11, 13, 17, 19, 23 and 29 (thus: 1...31...61...91...n; 7...37...67...97...n; etc.).

The products of *any* combination of factors in the array = a number in the array, e.g.,
7*11 = 77; 7*11*13 = 1001; etc. Conversely, all factors for composite numbers in the array can be found in the array.

The sum of *any* sequential odd number of addends in the array = a number in the array, e.g.,
1+7+11 = 19; 1+7+11+13+17 = 49; etc.

Because the digital roots of all prime root angles are either 3 or 6, any prime root angle times another will produce a product whose digital root = 9, e.g., PR7 (84°) x PR29 (348°) = 84 x 348 = 29232 = dr(9).

Any number in the array x 30 + 1 = a number in the array.

The sum of the angles for 2(24°), 3(36°) and 5(60°) = 120°, and the sum of the prime roots (1+7+11+13+17+19+23+29) also = 120. This is because the prime roots are an arithmetic anagram for the angles of the first three primes, thus: 11+13 = 24; 17+19 = 36; and 1+7+23+29 = 60. The sum of the second rotation = 360 ... 3(2[24°] + 3[36°] + 5[60°]) = 30[360°]

The array reveals beautifully symmetrical relationships:

1[12°] + 29[348°] = 30[360°]

7[84°] + 23[276°] = 30[360°]

11[132°] + 19[228°] = 30[360°]

13[156°] + 17[204°] = 30[360°]

Mod 30 of all numbers in this array (and thus all primes other than 2, 3 and 5) must be 1, 7, 11, 13, 17, 19, 23 or 29.

The sum of the digital root sums of the prime roots (1, 7, 11, 13, 17, 19, 23, 29) = 1+7+2+4+8+1+5+2 = 30.

This sieve reveals why all primes >5 are adjacent to a multiple of six, as the prime root radii are adjacent to 6(72°); 12(144°); 18(216°); 24(288°); and 30(360°). [And you'll note that the digital root sums of all adjacent angles equal 9.]

For a detailed discussion of efficient factorization and prime number sieving algorithms, as well as an in-depth analysis of
the 8-chord progression and deterministic modulo 90 digital root dyad sequences underlying all factorizations employing this sieve,
click here: **Prime Number Sieving Algorithms**.

[Note: If you use Python (the computer programming language designed for the development of scientific, engineering and mathematics applications) and want to cut to the chase, check out the MIT licensed Python module dubbed "pyprimes" designed to run and compare prime number sieving algorithms, including the Prime Spiral Sieve (referred to by its former name, "Croft Spiral"), here or here at code.google.com. The programmer, we're pleased to report, rates the Prime Spiral Sieve "fastest/best" and recommends it as "the preferred way of generating prime numbers" compared to several sieves tested.]

For a detailed discussion of the geometries and algorithms that ultimately determine the distribution of twin primes along
three 'distribution channels' go to this page: **Twin Primes Demystified: Prime Pair Distribution
Algorithms and Symmetries**.

Although not particularly straightforward, there is a method whereby one can calculate the number of prime numbers in a given range with considerable precision using this Sieve. To illustrate, below is a step-by-step procedure to determine the number of primes in the range 1 thru 10,000 [Note: Please consider this section to be more conceptual outline than final product in as much as the author will not be satisfied until the process is drastically improved.]:

- First, calculate the number of integers within the range not divisible by 2, 3 and 5. Since 8 out of every 30 integers fall into this category, we have 8/30 = .2666666666... or 26.66%. Multiplying 10,000 times .266666... gives us 2666. (This is our starting point. The steps that follow will identify the number of non-primes to subtract until we've boiled 2666 down to reflect only prime numbers.)
- Next, given that the square root of 10,000 is 100, we know that we need to perform chord factorizations from 7chord to 97chord to generate products (i.e., non-primes) less than or equal to 10,000 (reference "The 8-Chord Progression," above). Doing so will index all composite numbers in this array (aside from those divisible by 2, 3 and 5, already removed in step 1).
- We then count the number of calculations required to complete step 2, above. This gives us 1847. (To open an Excel spreadsheet showing in detail how this number is derived, click here. This may take several seconds!)
- Because the factorization process generates a number of duplicate products, we must count and subtract these from the total in step 3. [Note: These duplications were described earlier, and the example given is repeated here: 7*77 = 539 is equivalent to 11*49 = 539; both expressions being equivalent to 7*7*11 = 539.]. In our example, we find that there are 411 such duplications; subtracting these from the number of factorizations (1847-411) gives us 1436. To open an Excel spreadsheet listing the duplicates and their count, click here.]
- Next, we subtract the result in step 4 (1436) from the result in step 1 (2666), i.e., 2666-1436 = 1230.
- The final step is to subtract 1 from the total in step 5 to account for the fact that the number 1 is not a prime; this
leaves us with a balance of 1229, which is
*exactly*the number of primes between 1 and 10,000.

No doubt this procedure can be simplified. For example, one could probably devise formulas to determine the number of factorizations and duplicates, eliminating the need for a spreadsheet count.

The squares of all numbers in the array distribute along two–and only two–prime root radii: 1(12°) and 19(228°). It thus follows that the squares of all prime numbers >5 can only be found distributed along prime root radii 1(12°) [mod30 = 1] and 19(228°) [mod30 = 19]. This is consistent with the fact that the quadratic residues for modulo 30 (making them congruent with perfect squares) are 1 and 19. Also, this can be validated with digit sum arithmetic, given that a) All perfect squares end in 1, 4, 5, 6, 9 or 0, only two of which (1 and 9) apply to our domain, i.e., when mod30 = 1, 11, 19 or 29; and b) All perfect squares possess digital roots of 1, 4, 7 or 9, which in the case of our domain narrows the possibilities to mod30 = 1 or 19, as all mod30 11 and 29 elements possess digital roots of 2, 5 or 8. [And it follows that all squares in this series distribute evenly to two of the three twin prime distribution channels, described above, negating a significant percentage of potential prime pairs.] The matrix below illustrates the distribution of squares from 1*1 thru 59*59 (squares hi-lited in blue):

From the above you can see that all squares distribute as follows: A*A (translated as any squared mod 30,1 number in the array will produce a mod 30,1 product), C*C, F*F and H*H distribute to A (mod 30,1..12°), while B*B, D*D, E*E and G*G distribute to F (mod 30,19..228°).

Summarizing the above relationships in mathematical terms (and in the knowledge that these modular relationships apply to the squares of all prime numbers ≥ 7) we get:

for all n where n mod 30 = 1, n^{2} mod 30 = 1

for all n where n mod 30 = 29, n^{2} mod 30 = 1

for all n where n mod 30 = 11, n^{2} mod 30 = 1

for all n where n mod 30 = 19, n^{2} mod 30 = 1

~~~~~~~~~~~~~~~~~~~~~~~~~~~

for all n where n mod 30 = 7, n^{2} mod 30 = 19

for all n where n mod 30 = 23, n^{2} mod 30 = 19

for all n where n mod 30 = 13, n^{2} mod 30 = 19

for all n where n mod 30 = 17, n^{2} mod 30 = 19

~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Ulam Spiral arrays prime numbers in fragmented spiral and diagonal formations. Quoting from Wikipedia: "Since in the Ulam spiral adjacent diagonals are alternatively odd and even numbers, it is no surprise that all prime numbers lie in alternate diagonals ... What is startling is the tendency of prime numbers to lie on some diagonals more than others." From this one might deduce that the Ulam Spiral is very likely a scrambled version of the Prime Spiral Sieve as the latter demonstrates how all prime numbers (except 2, 3 and 5) are fundamentally arrayed along eight (and only eight) diagonals.

It would appear, circumstantially, that the Prime Spiral Sieve is mathematically harmonious and perhaps isomorphic with the most complex and visually arresting Lie group, named E_{8}, which–like the Prime Spiral Sieve–is 8-dimensional (E_{8} is pictured below superimposed with a star polygon and the 8 radii of the modulo 30 factorization wheel). This group was recently in the news as possibly being a key to unifying theories in gravity and particle physics to create the proverbial "theory of everything." The number 30–integral to the Prime Spiral Sieve–is the Coxeter Group number *h*, dual Coxeter number and the highest degree of fundamental invariance of E_{8}. You'll note, looking at the graphical representation of E_{8} below, that the perimeters of every one of its multiple concentric circles possesses 30 points. And, not surprisingly, E_{8} has 2-, 3- and 5-torsion and its exponents are the co-primes up to 30, i.e., 1, 7, 11, 13, 17, 19, 23, and 29–numbers you're very familiar with if you've read to this point ... which brings us
full circle Ο:

We'll close with a graphic showing E_{24} superimposed with the 24 radials of a modulo 90 factorization wheel and the 15 points of a 15-point star represented with red dots, each point separated by 24°:

Your feedback welcome! Email: gwc@hemiboso.com

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.