
On Periodic Patterns in the Prime Clockwork – September 15th, 2024, Michael Emmerich
I have two rotating gears, with 90 and 54 teeth. When do the starting points of these gears align?
When do the gears align again? The textbook answer is the least common multiple—though for two gears, their alignment is simply the product of their teeth, if and only if those gears are coprime. This mechanical precision can even define what it means to be prime. In this essay, we visit the clockwork of prime cycles, which generates integers and primes not by traditional means of divisibility or multiplication, but by following a method that generates the configurations of the cog wheels step-by-step, where each move generates a new configuration until all possible configurations were encountered and the wheels are aligned again.
This essay builds on the theories of the ‘prime clockwork’ and ‘prime vectors’ by focusing on recurring modulus combinations. It proves an upper bound for prime density and shows integer factorizations as zeros of a complex function, offering a visualization of the prime clockwork which we will present as interactive python code.
The prime clockwork (
Emmerich24b) is an automaton that generates integers one-by-one in their prime factorization. It uses the metaphor of an array of different clocks, each congruent with a prime number. As a whole, the prime clockwork generates the integers (total seconds that have passed) starting from one, step-by-step as prime vectors, that is, in their unique integer factorization. The prime clockwork uses only integer addition and comparisons, avoiding division and multiplication and each subsequent state of the clockwork depends solely on the preceding state.
We can depict the output of the prime clockwork as a table (See Table 1), each row representing an integer, and each column associated with a prime and showing the exponents of the prime factorization of that integer. Alternatively, we may just look at the congruences (moduli) of the integer with the primes (Table 3). These are the analogues of second counters for clocks, that turn around not in 60 seconds, but in
seconds.
Iterating over the rows (associated with the natural numbers or the seconds that have passed) we aim to find and confirm periodic patterns over subsets of columns (each column associated with a prime number exponent in the prime factorization or modulus), detailing their nature and lengths.
In this essay will discuss the following topics:
- Subsets of Columns and Long Cycles: Fixing columns tied to prime moduli creates long cycles of repeated configurations over time.
- Cycle Length: The length of these cycles is exactly the product of the primes associated with the selected columns.
- Combination of modulus values (‘second counters’): Within each long cycle, the seconds counters
with
of the prime clocks go through all possible combinations.
- Visualization of Prime Clocks as Complex Functions: Representing the clockwork with time dependent exponential functions with complex exponents (that appear in the plot as concentric circles) represents the prime clockwork as points orbiting the origin at a radius that is proportional to the defining prime number of a clock; all points move with exactly the same speed. Each alignment of points with the positive real axis of a subset of prime clocks marks the end of a long periodic cycle, revealing prime factor of the integer that represents the given time.
The concept of prime vectors and prime clockwork offers a different perspective on integers and prime numbers. While the theoretical results might not all new in the well researched field of number theory, we hope that the new perspective can offer some new ideas. We are certainly inspired by number theory’s rich history but we develop lemmas from basic principles and prefer to build theories up from scratch using elementary methods, driven by curiosity. Please leave a comment to reference related work or identify errors.
1. Prime Vectors
Prime vectors, introduced for instance in
Emmerich 2024a represent -adic orders as tuples in a positional notation and play an essential role in the definition of the prime clockwork. For
, represent
as
, where
are primes and
. We define a prime vector as an infinite list
. The mapping between integers and prime vectors is
, with the inverse
. The space of prime vectors is
. Define the
operator on
as
, and observe that
2. Prime Clockwork
The prime clockwork was introduced earlier in this blog
Emmerich 2024b.
Definition 1 A prime clock for prime, denoted
, is a recursive automaton starting at
and generating an output
each iteration. It has a seconds counter
that is increased by one in each iteration and reset to
before it reaches
, i.e., it holds
. It has a minutes counter
that starts with
and increases by one after each reset of the seconds counter. The prime clock outputs
whenever
, and
otherwise.
Definition 2 The dynamic prime clockwork starts with only one active prime clock in the array, the prime clock for. As the counting process progresses, new prime clocks
are activated and added with
when all active prime clocks output
simultaneously for the first time, which implies
is a prime number.
We use the term dynamic prime clockwork, if we want to emphasize that prime numbers are generated on the fly. Otherwise, we just use the term prime clockwork.
3. Grand cycles
Although the process of generating primes is known for its irregularity, there are processes the prime clockwork performs that perform long cycles of periodically repeated patterns. Let us have a closer look at these.
Definition 3 {Binary Prime Clockwork} Let us define a simplification of the output of the prime clockwork with outputs(prime factor exponents) as follows.
Similarly to prime vectors
, we refer to the result of these sequences as binary prime vectors, which we represent by
.
Please see an example of the (binary) prime clockwork output for the integers from 1 to 30 in the Table 1 and Table 2 (for the binary clockwork). The modulo remainders for the primes defining the columns are listed in Table 3, and we will discuss them later on.
Remark 1 The sequence ofcould be simulated correctly without computing
by a simplified dynamic clockwork.
Remark 2 This abstraction of the prime clockwork output serves two purposes:
- The appearance of new primes relies only on the presence of
s in the output, and consequently, the exponents in the prime factorizations may be of little importance for questions regarding the distribution of the primes.
- The sequences
repeat subsequences, unlike
.
Now, let us examine the characteristics and duration of the recurring sequences.
Lemma 1 Letbe a subset of natural numbers. Consider the rows of the prime clockwork table indexed by time
, denoted
, and let
represent the projection of
onto the columns corresponding to the indices
.
The sequence
is periodic with period
, where
are the primes associated with the indices
. Specifically, for all
,
In other words, the sequence
repeats itself every
iterations, starting from
.
Proof: The seconds counters for each prime clock
reset to zero simultaneously exactly when
is a multiple of
. This marks the start of a new cycle where the sequence
repeats. Since the behavior of each prime clock is determined by its position within its own cycle, and since the clocks are independent, this pattern of outputs will recur every
steps.
Lemma 2 Within one complete cycle of length, the sequence of seconds counters
covers all possible combinations of the form
Proof: Each prime clock cycles through all its possible seconds counter values
from
to
. The next state of the seconds counters is determined by the previous state. There must eventually be a state
, beginning a new cycle at period
. Any repeated state before reaching
would indicate a shorter cycle excluding
An example can be seen in Table 3. For instance the subset of columns P2 P3 and P5 goes through all combinations of seconds counters (or , or
), when
ranges from
to
.



Application: Upper Bound for the Density of Primes
A simple application is the following upper bound for the density of primes by counting the number of coprimes to a given set of prime numbers and their combinations in a certain interval. Let be the first
prime numbers. The total number of rows corresponds to the product
, which is the period over which all combinations of modulus values occur.
- Total number of combinations:
- Number of combinations with no null values:
- Number of combinations with at least one null value:
At the end a simple lemma, that can be easily understood based on the moduli values of the clocks.
Lemma 3 Ifand
are coprime with each other, then their sum
is coprime to
and
.
Proof: The remainders (moduli, seconds hands) associated with the prime factors of become zero only at multiples of
. Similarly, for
, the remainders become zero at multiples of
. However, since the sum
is not divisible by either
or
, it follows that the remainders for the prime factors of both
and
are never zero.
An upper bound for the primes and density of certain coprimes
Let be the first
prime numbers. The total number of possible combinations of moduli across all rows from 1 to
is given by
. The number of combinations in which all moduli are non-zero is given by
. The ratio of these non-null combinations to the total combinations is
.
Lemma 4 The number of primes in the interval fromto
is at most
and the ratio of prime numbers is at most:
.
Proof: If the prime number is among the first primes or the first
primes do not divide it (i.e., all moduli are non-zero), then a number could be prime. If these conditions fail, the number is not prime. However,
can still be divisible by a prime with
, making
a measure of how far this upper bound is from being tight.
Let us remark that the bound exactly determines the number of coprimes to any of the composites formed of the first primes in the given interval. In other words all numbers that are not covered must either be primes themselves, greater than
, or they are composites of primes greater than
.
Table 4 below shows the number of combinations and upper bounds for the numbers of primes that one can achieve with this method for combinations of up to 10 primes. We compare it to the known number of primes in the interval.
Visualization of Primes as Complex Exponentials
This section presents a visualization of prime numbers represented as points on concentric circles in the complex plane. Each circle’s radius is proportional to a prime number, and the points on the circles are given by the formula:
where is the
-th prime number, and
is a parameter that varies.
In the provided plot (Figure 1), the first 10 prime numbers are used, with each prime corresponding to a circle of radius
. For a fixed value of
, the points
are plotted on their respective circles.
Example:
Consider the example where . The points on the circles are determined by:
For each prime , this expression results in a unique point on the circle of radius
. The plot shows these points in red, illustrating their positions at
on the respective circles.
This visualization highlights the rotational symmetry and the behavior of primes when represented as complex exponentials, offering an intuitive geometric interpretation of primes in the complex plane.
It can be observed that the points travel at the same speed on the circles.
Lemma 5 The pointson the circles travel at a uniform speed.
Proof: The circumference of a circle is and the points complete a full revolution every
iterations. Thus, the speed remains the same, irrespective of the circle.
From the theory of cycles in the prime clockwork the following lemma be easily observed
Lemma 6 Given an integerpositive zeros of the functions
are the prime factors of
.
Remark 3 The x-axis crossings of a prime clock with radius 1 can be used as an equation that needs to be satisfied whenis integer.
Lemma 7 A numberis prime, if and only if
is the minimum
such that
, and for the preceding primes
it holds
.
The visualization of integers using the modulus of prime numbers as positions on orbits around the origin offers an intuitive yet comprehensive representation of the prime clockwork. This echoes the earlier metaphor of gears and intertwined cogwheels introduced at the beginning of this essay. Even more captivating is witnessing these wheels in motion. To bring this concept to life, we’ve provided a graphical demonstration powered by a small Python program with interactive source code, available at the following link:
https://trinket.io/pygame/b4608620d3e0?showInstructions=true
The program that produced the static plot of the example we provided at the end of our essay. You can change the integer parameter t and get different configurations of the prime clockwork from which all moduli (prime) values and prime factors can be seen in a single view.


