# The Prime Spiral Sieve

### Radial Geometry and Chordal Algorithms Demystify the Prime Number Sequence

"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 work is licensed by its author, Gary William Croft, under a Creative Commons Attribution-ShareAlike 3.0 Unported License

## Introduction

This site explores a deterministic algorithm and geometry in the form of a spiral sieve encompassing eight factorization progressions that intertwine like an octal helix and ultimately determine the distribution of prime numbers greater than five (5). (Prime numbers defined as natural numbers only evenly divisible by 1 and themselves.)

To date this site has attracted more than 75,100 "absolute unique visitors" (Google Analytics speak) from 8,717 cities representing most every country on Earth. Scores have returned repeatedly, and not one has offered counter-examples. From a hermeneutic perspecitve, the patterns explored herein speak eloquently for themselves ... Res ipsa loquitur ...

The sequence populating the Prime Spiral Sieve (pictured below) can be variously defined as:

♦  Natural numbers not divisible by 2, 3 or 5. And given no prime number > 5 is divisible by 2, 3 or 5, it's axiomatic that the domain contains all prime numbers > 5, starting with 7 (the number 1 being "silent")... and their multiplicative multiples, beginning with 7 x 7 = 49, the first composite number in the sequence. It follows that all members of our domain are relatively prime (aka coprime or mutually prime) to 2, 3 and 5.

♦  Natural numbers ≡ {1, 7, 11, 13, 17, 19, 23, 29} modulo 30, which parse into 8 arithmetic progressions, each with a common difference of 30 between consecutive terms.

♦  1 {+6 + 4 + 2 + 4 + 2 + 4 + 6 + 2} {repeat ... ∞}.

♦  30n+1, 30n+7, 30n+11, 30n+13, 30n+17, 30n+19, 30n+23, 30n+29.

♦  Natural numbers modulo 30 that distribute to the following 8 angles: 12° ... 84° ... 132° ... 156° ... 204° ... 228° ... 276° ... 348°.

♦  All odd numbers with digital root of 1, 2, 4, 5, 7 or 8 and final digit of 1, 3, 7 or 9 ... the first 8 of which are 1, 7, 11, 13, 17, 19, 23, 29.

It's important to note that the beautiful symmetries encountered within this domain, both numeric and geometric, are largely a consequence of patterns rooted in its period-24 digital root, which has the following repetition cycle: {1, 7, 2, 4, 8, 1, 5, 2, 4, 1, 5, 7, 2, 4, 8, 5, 7, 4, 8, 1, 5, 7, 2, 8} {repeat ...}. This is equivalent to three rotations around the Prime Spiral Sieve.The first 24 members of our domain are thus especially important in relation to these cycles. For convenience, and to emphasize this modulo 90 periodicity, we occasionally frame them as: Numbers ≡ to {1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89} modulo 90.

Below is a picture of the Prime Spiral Sieve showing rotations spanning numbers 1 thru 259 of the infinite sequence populating the sieve, as defined above:

Hidden deep within this sieve, a radical spin on modulo 30 wheel factorization, are mysteriously beautiful symmetries and geometries, profound in their implications. This sieve not only forms the basis of an extremely efficient and widely used prime number sieving algorithm of the 'non-probabilistic' kind, but it 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. It can be conceived as both an infinite spiral and–when matrix factorized at the digital root level–an ever-expanding 4-sided pyramid structured at the deepest level by palindromic sequences. Regardless, the real power of this geometry becomes evident when we triple it dimensionally and explore modulo 90 factorization symmetries 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.

Most profoundly, we'll discover how the eight spiraling factorization algorithms, i.e., the multiplicative multiples of the domain's sequence starting with 72 that ultimately account for every composite number within the Prime Spiral Sieve's orbits, are structured by rotational symmetry groups in the shape of equilateral triangles ( {1,4,7} {2,5,8} {3,6,9} ) that form 3 x 3 matrices which in turn extrapolate into beautiful complex polygons.

Only elementary arithmetic and geometry are required to understand what you find on this site. This minimal requirement is reflected in a quote from Prime Numbers and the Riemann Hypothesis by Mazur and Stein: "It is striking how little you actually have to know in order to appreciate the revelations offered by numerical exploration."

Our approach, rooted in empirical observation, is more expository than technical, 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): "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.] Though our method requires minimal mathematical knowledge, it can nonetheless deliver 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. With one exception, our Proof by Construction for the Digital Root Sequencing of Twin Primes, you'll be disappointed if you're seeking rigorous proofs here. Yes, we're well aware of the mantra "Observations Aren't Proofs." However, we hope you'll concede that "observations precede proofs," the Reimann Hypothesis being the most famous example. Speaking of which, Karl Sabbagh, writing in The Riemann Hypothesis: The Greatest Unsolved Problem in Mathematics, quotes highly regarded mathematician Hugh Montgomery as saying: "Philosophically, I'm a firm believer in trying to form conjectures far beyond what one can prove ..." Or, as Marcus Du Sautoy put it, prefacing a quote by Richard Feynman, "[A]s a physicist I hold Feynman's dictum dear: 'A great deal more is known than has been proved.'" In that spirit, if your intent is to better understand how prime numbers are sequenced, read on. Through words, illustrations and elementary arithmetic, we'll show how prime numbers are sequenced deterministically; their seeming randomness an illusion.

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 prime number and related patterns. We will demonstrate in great detail, supported by diagrams and graphics the entire way, why "... prime numbers exhibit stunning regularity [and] obey laws with almost military precision." (quoting from Don Zagier's The First 50 Million Prime Numbers)

Twelve of the sequences discussed on this site have been published by the author on the On-Line Encyclopedia of Integer Sequences. Here's a link to them: OEIS Listings for Gary W. Croft

Also, an M.I.T. licensed (Python) Prime Factorization Tool compared seven non-probabilistic prime number sieving 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."

Further validation comes from Fredrick Michael, PhD (Director Experfy Institute / Harvard Innovation Laboratories), who utilized this site's period-24 model of primes and composites in a study of statistics and modular arithmetic of prime numbers. An abstract of the referenced study can be found at Notes on Prime Numbers, Their Numerical Statistics & Patterns I: Modular Arithmetic and the Eight Fold Period 24 Model. The period-24 patterns in question, relating to modulo 90 factorization algorithms and the digital root dyad cycles generated by twin primes, are discussed at length on our page devoted to demystifying Twin Primes.

## Foundations

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, Cunningham Chains ... 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 (n2 -2 and n2 +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 first rotation of the sieve, comprised of 8 members, (1, 7, 11, 13, 17, 19, 23 and 29), is the deterministic key to everything that follows. These are the first 8 counting numbers not divisible by 2, 3 or 5, a sequence which by definition includes (and only includes) 1 and all primes ≥ 7 and their multiplicative 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). The inference of this conjecture is that all prime numbers greater than 5, i.e., starting with 7, can be produced by this expression.

[Note: Given our domain is limited to numbers ≡ {1,7,11,13,17,19,23,29} modulo 30," only ϕ(m)/m = 8/30 or 26.66% of natural numbers need be sieved. 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 physicist and mathematics popularizer 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): xnyn ± zn where x=2, y=3 and z=5. Thus: xnzn ± yn and ynzn ± xn.

Given that all prime numbers > 5 are in the array, it is conjectured that this expression can be configured to generate all primes >5. What is critical to understand, is that the invisible hand of 2, 3 and 5, and their factorial 30, create the structure within which the balance of the prime numbers, i.e., all those greater than 5, are arrayed algorithmically–as we shall demonstrate. Primes 2, 3 and 5 play out in modulo 30-60-90 cycles (decomposing to {3,6,9} sequencing at the digital root level). Once the role of 2, 3 and 5 is properly understood, all else falls beautifully into place.

## Deep Symmetries

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 our domain (natural numbers not divisible by 2, 3 or 5), 13,937,179 (see graphic, above), is a prime number and a member of a twin prime pair (with 13,937,177). In case you're wondering, 13,937,179 is not a reversible prime (as the reversal is a semi-prime: 9,461 x 10,271 = 97,173,93). However, given all the repunits that follow, we take note that both of the reversal's factors are congruent to 11 (mod 30 & 90).

Perhaps most remarkable of all, 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 palindromic 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.

Another point of interest: the terminating digits of the first 8 Fibonacci numbers indexed to our domain (13937179) contain two each 1's, 3's, 7's, and 9's. This is also true of the terminating digits of the first eight members of our domain (17137939).

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): F17 (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.

## The Prime Spiral Sieve

Around the perimeter of the spiral sieve (pictured 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 congruent to {7} modulo 30 (radial angle 84°) and {23} modulo 30 (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).

## Conjectures and Facts Relating to the Prime Spiral Sieve

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: xnyn ± zn, xnzn ± yn and ynzn ± xn. For example: 2 * 3 + 5 = 11 ... 23 * 5 - 33 = 13 ... 32 * 5 + 2 = 47 ... 52 * 3 - 2 = 73. To see more examples (1 thru 101) click here. This expression, therefore, potentially generates all numbers not divisible by its three terms, 2, 3 and 5, including all prime numbers >5. [Note: For any given number in the array, there are multiple–and possibly an infinite number of–solutions. For example, the number 11 can be expressed as xy+z = 11, x2y2-z2 = 11, z2y-x6 = 11, etc.]

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.

Every composite number in our modulo 30 domain can be derived from the product of two terms in the domain multiplied together, and these multipliers need not necessarily be prime themselves. For example, 5831, which is congruent to 11, modulo 30, and therefore in the array, is the product of 49 x 119 = 5831. In this example, neither 49 (7 x 7) nor 119 (7 x 17) are prime, though both are members of 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.]

The modulo 90 congruence of any member of this domain can be determined by digital root and terminating digit configured in an xy matrix: arrayed by digital root {1, 2, 4, 5, 7, 8} on the vertical axis and by terminating digits {1, 3, 7, 9} on the horizontal axis. Take, for example, number 179 (which happens to be prime): Its digital root = 8 and its terminating digit = 9. Looking at the table below, we can quickly determine that 179 is congruent to 89 modulo 90.

By definition prime factors for all composite numbers within this domain must originate from within it, which is why all composite numbers are reducible to one or more modulo 90 'congruency dyads' traceable to the first 24 members of this domain:

## Factorization and Sieving Methods Employing the Prime Spiral Sieve

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.

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 non-probabilistic prime number sieving algorithms, including the Sieve of Eratosthenes and the Prime Spiral Sieve (referred to by its alternative name, "Croft Spiral Sieve"), 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 the several sieves tested.

[Note: Although "pyprimes" is an efficient algorithm, we're waiting for a savvy programmer to appreciate that processing speed can be increased exponentially by plotting loci within a 24-wide matrix generated by 24 each period-24 deterministic modulo 90 progressions (which can run in series-parallel, for even greater speed). Once the 'loci chord' progression algorithm(s) are set up and initialized, the need for multiplication and/or division is eliminated. This method involves pattern generation–not number crunching.

What we're proposing is neither factorization nor primality testing, per se, but rather an extremely efficient deterministic (not probabilistic) method to index composite numbers within this domain, i.e., numbers not divisible by 2, 3 or 5 when framed congruent to {1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89} modulo 90.

This 24-wide matrix can be populated numerically after-the-fact, all composite numbers having been located by the algorithmically generated loci patterns which constitute an array of entertwining chordal progressions. When the process of pattern superimposition is complete, all primes greater than 5 within the domain up to a given n are completely differentiated from composite numbers.]

## Counting Primes

The Prime Spiral Sieve can be used to count the number of prime numbers within a given range (from 0 to n) with absolute precision, albeit in several unconventional steps. It does so employing the four elementary operations of arithmetic: addition, subtraction, multiplication and division, and the taking of one square root. You could say that this approach is more recipe than function, algorithm, or asymtotic analysis. Regardless, what makes this method novel is that it parses and counts the number of primes without the need to identify any specific primes other than the first three: 2, 3, and 5, i.e., there's no requirement for primality testing, per se.

As we detailed in our discussion of modulo 30 factorization algorithms, all composite numbers within the domain of counting numbers not divisible by 2, 3 or 5 can be accounted for algorithmically. We also demonstrated how the number of factorization computations, per se, within specified parameters (from 0 to n) can be counted with perfect precision (albeit 'manually' using spreadsheet formulas). We conjectured, therefore, that upon running such a count the remaining balance would be primes exclusively (leaving one last step; adding 3 primes to our total to account for 2, 3, and 5, excluded from our domain by definition).

Our logic proved sound ... so far as it went. As you will learn below, we have created a counting method that eliminates the need for a spreadsheet count of factorization dyad calculations from zero to n (with the cautionary note added that we've only tested the method four times, albeit it was 100% accurate in all four cases, as shown below). Regardless, what we didn't anticipate was how difficult it is to formulate (rather than mechanically count) the parsing of equivalent factorizations, i.e., those with identical products but dissimilar factor dyads. For example, of the 105 modulo 30 wheel factorizations that identify (index) all composite numbers in the 0 to 1000 range, we found 5 replicants, namely:

♦  539 =   7 x 77 = 11 x 49
♦  637 =   7 x 91 = 13 x 49
♦  833 = 7 x 119 = 17 x 49
♦  847 = 7 x 121 = 11 x 77
♦  931 = 7 x 133 = 19 x 49

We get a clearer understanding of the sequencing of our five 'replicants' when we express them as prime factorizations:

♦  72 x 11 = 539
♦  72 x 13 = 637
♦  72 x 17 = 833
♦  72 x 19 = 931 (stop: as 72 x 23 = 1127, which is > 997)
♦  112 x 7 = 847 (stop: as 112 x 11 = 1331, which is > 997)
(and, of course 132 x 7 = 1183 also exceeds 997, the limit of our defined range ... STOP! as does 7 x 11 x 13 = 1001)

For now we can state that, although Replicant Factorizations (RF's) can be easily explained, quantifying them formulaically remains a daunting challenge given we're not seeking an "error approximation" but rather an exact count.

That being said, using our method as it currently stands (i.e., wanting a better RF counting method) what follows are steps to calculate the number of primes within three arbitrarily chosen ranges, and a fourth example chosen literally at random (throwing a dart at a printed page containing several hundred prime numbers):

0 → 10,000 (with 1229 primes);
0 → 1,000 (with 168 primes);
0 → 892 (with 1000 primes):
0 → 2099 (with 317 primes):

Example 1: Count Primes from 0 → 10,000 = 1229

1. First, calculate the number of natural numbers < 10,000 not divisible by 2, 3, or 5, i.e., n ≡ {1, 7, 11, 13, 17, 19, 23, 29} modulo 30. Since 8 out of every 30 natural numbers {1, 2, 3, ...} fall under this modular set, we multiply the highest number < 10,000 that is n ≡ {1, 7, 11, 13, 17, 19, 23 or 29} modulo 30 (in this case 9,997) times 8/30, or .2666 (8/30 being the ratio of numbers not divisible by 2, 3, or 5 to natural numbers). And thus, 9,997 x 8/30 = ⌊2665⌋ (floor brackets signify whole number part taken).

This is our starting point. The steps that follow will identify the number of composite numbers to subtract by a counter-intuitive process of elimination until we've reduced 2665 down to the point where only prime numbers remain.

2. Given that the square root of 9,997 is 99.98, we know that we need to perform chord factorizations from 7chord to 97chord to identify composite numbers in our range less than or equal to 9,997 (reference "The 8-Chord Progression," above). Doing so will index all composite numbers in this range (as distinct from numbers divisible by 2, 3 and 5, already removed in the previous step).
3. We then count the number of composite generating calculations required to complete step 2. This gives us 1847 (keeping in mind that this number does not include the RF's noted in our introduction to this section). (To open an Excel spreadsheet showing in detail how this number is derived, click here.) (And below we offer a formulaic alternative to this manual counting routine.).
4. Next we count and subtract the RF's from the total number of factorization calculations generated in step 3.

In our designated range (1 thru 10,000), we find that there are 408 such duplications. Subtracting these from the total number of factorizations (1847 minus 408) gives us 1439. To open an Excel spreadsheet listing the duplicates and their count, click here.

5. Next, we subtract the result in step 4 (1439) from the result in step 1 (2665), i.e., 2665 minus 1439 = 1226.
6. Lastly, we must circle back and add 3 to our total to account for primes 2, 3 and 5, which by definition were excluded from our factorization domain. And, voila!, this brings us to 1226 plus 3 = 1229, the exact number of primes among the first 10,000 natural numbers.

As noted earlier, during our quest to invent a prime counting function, we stumbled upon a novel method to eliminate the need for manual counts of the algorithmically generated factorizations described in Step 3. This simplified formulation, which could form the basis of a function, is magical in that it incrementally trues the delta difference between the actual and calculated counts in perfect stair-step fashion: 0, 1, 2, 3, ... 24, additively summing to 300. (This 0, 1, 2, 3, ... n cummulative summation in the form n(n+1)/2 occurs with electrifying regularity no matter the highest n of a defined range, as the examples below demonstrate.)

A related formulation that produces the index number for any member of this sequence is worth documenting here: Any n congruent to {1, 7, 11, 13, 17, 19, 23, or 29} modulo 30 x 8/30 +1 = ⌊index number of n⌋ (whole number part taken). For example, 89 x 8/30 + 1 = 24.7333 (or 24, when whole number part taken). 89 is indeed the 24th member of our domain. It follows that, when configured as a function, the set of natural numbers 1, 2, 3, ... can be generated via numbers not divisible by 2, 3 or 5; namely:

f{x} * 8/30 + 1 = natural numbers 1, 2, 3, ... ⌊whole number part taken⌋ where x = n congruent to {1, 7, 11, 13, 17, 19, 23, 29} modulo 30 ... }.

When you subtract the sum of the cummulative corrections (300, in this case) from the total count of calculations (2147 minus 300) you get 1847, perfectly matching the actual count. [Note the taking of whole number parts (Columns C and E) and the downward adjustment (when necessary) of Column C results to n ≡ {1, 7, 11, 13, 17, 19, 23 or 29} modulo 30; the result posted under Column D.]:

* Note: Columns C & E: Whole Number Part Taken

Before leaving this example, it's instructive to study the patterns generated by the replicant factorizations within this range. Below is a screen shot from a spreadsheet that color codes the 408 replicant factorizations between 1 and 10,000, revealing their straight-line sequencing, extending both vertically and horizontally. (This is a sample: For the entire spreadsheet, click here: Replicant Factorization Patterns; tab labeled "Factorization Inventory").

From the spreadsheet linked above, parsing and tiering the distribution of Replicant Factorizations by their modulo 30 vertical alignment gives us the following counts:

Example 2: Count Primes from 0 → 1,000 = 168

* Note: Columns C & E: Whole Number Part Taken

Example 3: Count Primes from 0 → 892 (i.e., 7921) = 1,000

As we've noted several places on this site, there are exactly 1000 prime numbers between 1 and 892, i.e., between 1 and 7921. Here are the steps that get us to 1000:

1. Calculate population of the modulo 30 defined domain (see step 1 of the 1st example), thus: 7921 x 8/30 = 2112 (taking the whole number part). [Note: given 7921 is congruent to {1} modulo 30, and is therefore a member of our domain, we've pegged it as the highest number in our range.]
2. Take the square root of 7921 (which is 89) to determine the high end of our range of chordal factorizations for counting purposes.
3. Count number of sequenced factorization calculations (7 thru 89): 1396.
4. Count and subtract number of duplicate calculations to produce net number: 1396 minus 281 = 1115.
5. Subract 1115 from the domain population determined in step 1: 2112 minus 1115 = 997.
6. Add 3 to account for primes 2, 3, and 5: 997 plus 3 = 1000, the exact number of primes between 1 and 892!

Consistent with the < 1000 and < 10000 factorization counting function, we can take the same approach with 892:

* Note: Columns C & E: Whole Number Part Taken

Here's a link to an Excel.xlsx spreadsheet with three tabs containing data supporting the counts in the "Primes Less than 89 Squared" Summary, directly above: 1) Actual Factorization Counts; 2) Calculated Counts; 3) Replicant Analysis: 89 Squared and the First 1000 Prime Numbers.

Example 4: Count Primes from 0 → 2,099 = 317

* Note: Columns C & E: Whole Number Part Taken

Examining the 29 Replicant Factorizations distributed between zero to 2099 unambiguously reveals their genesis. The question remains how to parse them formulaically.

## Twin Primes

The world of twin primes is truly magical. For a detailed discussion of the factorization algorithms and symmetry groups (permutating matrices, orthogonal Latin squares, palindromes, equilateral triangles, complex polygons, etc.) that ultimately determine the distribution of twin primes along three modulo 30 'channels' go to this page: Twin Primes Demystified: Distribution Algorithms and Symmetries.

There you will be introduced to the beautiful 'Palindromagon' (pictured below), a complex polygon generated by tiered digital root dyad cyles central to the twin prime distribution channels (as well as modulo 90 factorization sequences). Its name comes from the fact that the triangulations generating it sum to a period-18 palindrome consisting of the six possible permutations of {3,6,9}, which in turn can be permutated to produce two 3 x 3 Latin squares with rows, columns and principal diagonals all summing to 18:

## Distribution of Perfect Squares

All perfect squares within our domain (numbers not divisible by 2, 3 or 5) possess a digital root of 1, 4 or 7 and are congruent to either {1} or {19} modulo 30. By definition, this includes the squares of all prime numbers greater than 5. We can easily explain this from a digital root perspective given that the digital roots of members of our domain are restricted to 1, 2, 4, 5, 7 or 8 (Numbers with digital root 3, 6, or 9 can't be members because they are divisible by 3.). Thus the digital root of squares is likewise restricted, as follows (and note the palindrome):

1 x 1 = 1
2 x 2 = 4
4 x 4 = 7
5 x 5 = 7
7 x 7 = 4
8 x 8 = 1

By arithmetic law, perfect squares can only have terminating digits of 1, 4, 5, 6, 9 or 0. Only two of these final digits (1 and 9) apply to our domain, i.e., for numbers congruent to {1, 11, 19 or 29} modulo 30. In turn, numbers congruent to {11, 29} sequence digital roots 2, 5 or 8, and therefore – as we demonstrated above – there can be no perfect squares among them. And so it is that the distribution of squares is narrowed to numbers congruent to {1, 19} modulo 30, which is to say they distribute along two – and only two – radii of the Prime Spiral Sieve: 12° (numbers congruent to {1} modulo 30) and 228° (numbers congruent to {19} modulo 30). (This is also consistent with the fact that the quadratic residues for modulo 30 (making them congruent with perfect squares) are 1 and 19.)

[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 twin prime pairs.]

The matrix below illustrates the distribution of squares from 1*1 thru 59*59 (squares hi-lited in blue):

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, n2 mod 30 = 1

for all n where n mod 30 = 29, n2 mod 30 = 1

for all n where n mod 30 = 11, n2 mod 30 = 1

for all n where n mod 30 = 19, n2 mod 30 = 1

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

for all n where n mod 30 = 7, n2 mod 30 = 19

for all n where n mod 30 = 23, n2 mod 30 = 19

for all n where n mod 30 = 13, n2 mod 30 = 19

for all n where n mod 30 = 17, n2 mod 30 = 19

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

When the digital root of perfect squares is sequenced within a modulo 30 x 3 = modulo 90 horizon, beautiful symmetries in the form of 24 period repeating palindromes are revealed, which the author has documented on the On-Line Encyclopedia of Integer Sequences as Digital root of squares of numbers not divisible by 2, 3 or 5 (A24092):

1, 4, 4, 7, 1, 1, 7, 4, 7, 1, 7, 4, 4, 7, 1, 7, 4, 7, 1, 1, 7, 4, 4, 1

In the matrix pictured below, we list the first 24 elements of our domain, take their squares, calculate the modulo 90 congruency and digital roots of each square, and display the digital root factorization dyad for each square (and map their collective bilateral 9 sum symmetry):

## From Alpha to Omega

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 E8, which–like the Prime Spiral Sieve–is 8-dimensional (E8 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 E8. You'll note, looking at the graphical representation of E8 below, that the perimeters of every one of its multiple concentric circles possesses 30 points. And, not surprisingly, E8 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 E24 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° (and we see that all nine twin prime distribution channels are hit dead center).