RC://LABS/PRIME-SPRING
PRIME SPRING
Wrap the integers around a manipulable spring and mark the primes. Change the number of integers per turn, reshape the spring and inspect it from different directions to expose residue classes, sieving structure and prime gaps. The underlying prime numbers stay fixed while the representation changes.
LAB STATUS · INTERACTIVE EXPLORATION · PUBLIC
This Lab visualises established arithmetic relationships and finite numerical data. Visual patterns are exploratory observations unless explicitly identified as exact consequences of the mathematics.
PRIME SPRING / DEFAULT STATE
- Range
- 1–100,000
- Prime count
- 9,592
- Default turn modulus
- 210
- Factorisation
- 2 × 3 × 5 × 7
- Primorial
- 7#
- φ(210)
- 48
- Prime-compatible (>7)
- 48 of 210 residue classes
At the default turn modulus, 210 = 2 × 3 × 5 × 7. Every prime greater than 7 must therefore occupy one of the 48 residue classes coprime to 210. The interactive instrument will expose that modular skeleton while keeping the distinction between arithmetic structure and visual representation explicit.
INTEGER RANGE
The integer range decides how far along the positive whole numbers this experiment looks. At the default value of 100,000, Prime Spring considers every integer from 1 through 100,000 and marks the ones that are prime.
WHAT THIS CHANGES
Increasing the range admits more integers into the experiment, so more actual primes become visible. Decreasing it gives you a smaller population that is often easier to inspect closely. The points are never guesses or samples: the Lab uses the exact prime dataset for the selected finite range.
The spring also stretches the currently selected population across the full available spring height. That means changing the range changes where a particular integer sits vertically in the drawing. This is a change of representation, not a change in whether that integer is prime.
WHY THE SLIDER FEELS NON-LINEAR
The range slider uses a logarithmic-style mapping. A simple linear slider from 100 to 500,000 would devote almost all of its physical travel to very large values, making the interesting low ranges awkward to explore. Here, ranges such as 100, 1,000, 10,000, 100,000 and 500,000 each receive useful room.
WHAT TO WATCH
At small ranges, individual prime points and short gaps are easy to distinguish. As the range grows, the picture becomes denser in absolute number of points, but primes make up a gradually smaller proportion of the integers. That long-run thinning is a genuine fact about the primes.
Be careful not to read the apparent vertical spacing of the points as a direct graph of prime gaps. The current range is being remapped into a fixed visual height, so the drawing is a coordinate representation of the data rather than a literal ruler.
TRY THIS
Start around 1,000 with fairly large prime points and look at the individual structure. Then move to 100,000 or 500,000 and reduce PRIME SIZE. Notice which broad patterns survive the change of scale and which details were only easy to see because the population was small.
PRIME SIZE
PRIME SIZE changes only the size of the dots used to draw prime numbers. It is a display control, not a mathematical parameter.
WHAT THIS CHANGES
Making the dots larger can help you follow individual primes, especially at a small integer range. Making them smaller can reveal lanes and larger-scale structure when tens of thousands of primes would otherwise overlap.
The underlying integer positions do not move. No prime is added or removed. Residues, sieve stages, prime gaps, the selected prime, and all numerical readouts remain exactly the same.
WHAT TO WATCH
A visual pattern can appear stronger when marks are large because nearby points merge into bright bands. The same pattern can appear weaker when marks are tiny. That is a useful reminder that visibility is not the same thing as mathematical existence.
Prime Spring already gives the dots a small perspective-aware size cue, so nearer points can read naturally in 3D. PRIME SIZE multiplies that existing drawing size; it does not replace the perspective calculation.
TRY THIS
Choose a dense view such as 100,000 or 500,000 integers and move PRIME SIZE from large to small. If a supposed structure disappears only because the dots stop overlapping, that tells you something about the picture. If the same geometric alignment remains clear, inspect it with the RESIDUE and SIEVE lenses to ask whether modular arithmetic explains it.
SPIRAL OPACITY
SPIRAL OPACITY controls how strongly the physical spring path and its central guide axis are drawn behind the prime points.
WHAT THIS CHANGES
At the maximum setting, the spring scaffold is easy to see and the connection between the dots and the helical object is explicit. As you turn the opacity down, the scaffold fades. At zero it disappears, leaving the prime points and any mathematical lens overlays visible on their own.
This does not alter the coordinates of a single integer. It only changes the visibility of the scaffold used to help you perceive those coordinates.
WHY THIS IS USEFUL
The coil is helpful when you are learning how the object is constructed, but it can also become visually dominant. Fading it lets you ask whether a feature belongs to the distribution of the plotted points or whether your eye was mainly following the drawn spring line.
RESIDUE and SIEVE guides are deliberately independent of SPIRAL OPACITY because they communicate arithmetic structure rather than the physical scaffold.
REPRESENTATION VERSUS FACT
The spring line is entirely representational: the prime numbers do not naturally live on a metal coil. The exact integer ordering, primality, divisibility and residue calculations are mathematical facts. Prime Spring uses the geometry as a way to make relationships among those facts easier to inspect.
TRY THIS
Set TURN MODULUS to 210, choose RESIDUE, then slowly fade the spring to zero. The residue lanes remain. This is a useful way to separate the arithmetic overlay from the decorative geometry carrying it.
TURN MODULUS
TURN MODULUS is the most important structural control in Prime Spring. The value M says how many consecutive integers make one complete turn around the spring.
FIRST: WHAT IS A RESIDUE?
When an integer is divided by M, there is a remainder. That remainder is its residue modulo M. For example, 17 divided by 6 leaves remainder 5, so we write 17 mod 6 = 5.
If M = 6, every integer therefore belongs to one of six residue classes: remainder 0, 1, 2, 3, 4 or 5. Because six consecutive integers make one turn of the spring, numbers with the same remainder return to the same angular position on successive turns. They form a visual lane.
WHAT CHANGING M ACTUALLY DOES
Changing M does not change the integers and it does not change the primes. It changes the coordinate system used to arrange those same integers around the spring. You are asking a different modular question of exactly the same prime dataset.
This is why the spring can look radically different when you change M. A dramatic visual change does not mean the primes themselves have changed. It means a different set of residue classes is being aligned into angular lanes.
WHY 6, 30 AND 210 ARE SPECIAL
6 = 2 × 3. Every prime larger than 3 is not divisible by either 2 or 3, so primes larger than 3 can occur only in residue lanes that are coprime to 6. There are just two such lanes: residues 1 and 5.
30 = 2 × 3 × 5. Now divisibility by 2, 3 and 5 is built into the turn length. Only 8 of the 30 residue classes are coprime to 30, so primes larger than 5 are forced into those 8 prime-compatible lanes.
210 = 2 × 3 × 5 × 7. This is the primorial 7#. Only 48 of its 210 residue classes are coprime to 210. That means 162 lanes are automatically ruled out for primes larger than 7 simply by divisibility by 2, 3, 5 or 7. This is why 210 creates such a striking modular skeleton.
WHY 211 LOOKS SO DIFFERENT
211 is prime. Therefore every non-zero residue from 1 through 210 is coprime to 211. Instead of only 48 prime-compatible lanes, there are 210 of them.
The same prime numbers are being plotted at M = 210 and M = 211. The sudden change in appearance is an important lesson: part of the visible structure comes from genuine divisibility facts, and part comes from choosing a coordinate system that aligns those facts strongly.
WHAT DOES COPRIME MEAN?
Two positive integers are coprime when they have no common factor greater than 1. For example, 11 and 30 are coprime, while 10 and 30 are not because they share factors 2, 5 and 10.
A residue lane being coprime to M makes it prime-compatible; it does not make every integer in that lane prime. For example, a number can avoid divisibility by 2, 3, 5 and 7 and still be composite because it has larger factors.
TRY THIS
Use the presets in order: 6 → 30 → 210 → 211. Keep the integer range and camera fixed. Switch to RESIDUE or SIEVE and watch how the admissible lanes change. This is one of the central experiments in the Lab.
SPRING SHAPE / PROFILE
The SHAPE controls change the physical geometry used to display the integer sequence. They do not change the arithmetic.
THE THREE NUMERICAL CONTROLS
BOTTOM RADIUS sets the width of the spring at its lower end. TOP RADIUS sets the width at its upper end. AXIAL STRETCH changes the height of the spring along its central axis.
The PROFILE buttons are convenient named combinations of those same measurements. CONE widens outward, CONE IN narrows inward, COLUMN keeps a constant radius, and TOY gives a shorter, broader spring. CUSTOM simply means that the individual controls no longer exactly match one of the named presets.
WHAT STAYS MATHEMATICALLY FIXED
The integers remain in the same order. The set of prime numbers remains fixed. The current turn modulus remains fixed. A statement such as 97 mod 210 = 97 is unaffected by whether the spring is a cone, a column or a short wide toy shape.
What changes is the spatial separation of the plotted positions. A feature that overlaps from one viewpoint can become much easier to see when the object is stretched or reshaped.
WHAT TO WATCH
If a pattern seems to appear only in one extreme shape, ask whether the geometry is exaggerating it. If an exact residue relationship is present, changing the shape may make it easier or harder to see, but the underlying residue calculation does not disappear.
TRY THIS
Select RESIDUE at M = 210, then move through CONE, COLUMN and CONE IN without changing anything else. You are looking at the same modular lanes embedded in different geometries. This is a good exercise in separating representation from mathematical fact.
PRIME / RESIDUE / SIEVE
The three LENS buttons do not change the underlying integer or prime data. They change which mathematical relationship the instrument asks you to notice.
PRIMES
PRIMES is the least interpretive view. The dots are the actual prime numbers in the selected range, placed at their current spring coordinates. No modular guide lanes are drawn.
This is useful when you want to look at the prime set without a residue overlay, but remember that the spring coordinates themselves still depend on TURN MODULUS and the chosen geometry.
RESIDUE
RESIDUE adds the angular lanes created by the current modulus M. Every integer belongs to one residue class modulo M, and numbers with the same residue occupy the same angular lane on successive turns.
The brighter guides are the residue classes coprime to M. These are called prime-compatible here because primes larger than the prime factors of M must occur in those lanes. This is a necessary condition, not a guarantee: many integers in a prime-compatible lane are still composite.
SIEVE
SIEVE starts with the residue lanes and lets you remove incompatible lanes factor by factor. If M = 210, the distinct prime factors are 2, 3, 5 and 7. Applying them in sequence leaves 210, then 105, then 70, then 56, then 48 surviving lanes.
This is closely related to the idea behind a sieve or wheel: eliminate numbers that are certainly composite because they are divisible by small primes, then inspect the candidates that survive.
AN IMPORTANT DISTINCTION
RESIDUE and SIEVE describe arithmetic restrictions on where primes can occur. They do not generate the primes. The violet dots remain the actual prime dataset, independently computed. A surviving lane contains candidates, including many composite numbers.
The visual strength of the lanes depends on the coordinate choice. The divisibility statement itself does not.
TRY THIS
At M = 210, move slowly from PRIMES to RESIDUE to SIEVE. First see the prime positions, then expose the modular lanes, then remove incompatible lanes one factor at a time. After that, change only M to 211 and repeat.
SIEVE STAGE
SIEVE STAGE lets you apply the distinct prime factors of the current turn modulus one at a time. It is showing a process of eliminating residue lanes that cannot contain ordinary larger primes.
WHAT IS THE SIEVE REMOVING?
The sieve is not deleting already plotted prime dots and it is not testing every visible integer individually. It is classifying whole residue lanes.
When factor 2 is applied, every residue divisible by 2 is eliminated. Applying factor 3 then eliminates the remaining residues divisible by 3. Further stages do the same for each distinct prime factor of M.
THE 210 EXAMPLE
For M = 210 = 2 × 3 × 5 × 7, the stage counts are exact:
210 → 105 → 70 → 56 → 48
After all four factors have been applied, the surviving 48 residues are exactly the reduced residue system modulo 210: the residue classes coprime to 210.
WHY ARE 2, 3, 5 AND 7 STILL VISIBLE?
This is an important small-number exception. The rule says that a prime larger than the factors used by the sieve cannot be divisible by those factors. But the factors themselves are prime.
For example, the number 5 is divisible by 5, so its residue lane is eliminated when the factor 5 is applied. Nevertheless, 5 itself remains a prime and must remain visible. Numbers farther along that same eliminated lane which are multiples of 5 are not prime candidates, but the prime 5 is a finite exception at the beginning of the sequence.
SURVIVING DOES NOT MEAN PRIME
A number that survives the 2, 3, 5 and 7 stages has merely avoided divisibility by those four small primes. It can still be composite because of larger factors. For example, products involving 11, 13 or larger primes can lie in surviving lanes.
TRY THIS
At M = 210, begin at ALL 210 and step through every stage slowly. Watch the large reduction caused by factor 2, then the smaller additional reductions caused by 3, 5 and 7. Keep the actual violet prime points in view while the candidate-lane structure changes underneath them.
PRIME PROBE
PRIME PROBE lets you stop treating the picture as a cloud of dots and inspect one exact prime as a mathematical object.
HOW TO SELECT A PRIME
Click or tap a visible prime point, or type an exact prime into the PRIME field and choose GO. The selected prime is highlighted in white so that selection is not communicated by colour alone.
The typed entry is also the precise keyboard and assistive alternative to trying to hit a very small dot on a dense plot.
WHAT THE READOUT MEANS
Ordinal is the prime's position in the ordered prime sequence. For example, 97 is the 25th prime.
Residue tells you the remainder when the selected prime is divided by the current turn modulus. Changing M can therefore change the displayed residue even though the selected number remains the same prime.
Previous and Next are the neighbouring primes. Gap before and Gap after are the integer distances to those neighbours.
Lane primes counts the actual primes, up to the current integer range, that occupy the same residue class as the selected prime.
WHAT DOES log(p) MEAN?
Near a large number p, the average scale of prime spacing is roughly log(p), where log is the natural logarithm. This comes from the large-scale fact that primes have density roughly 1 / log(x).
It is not a prediction of the next individual gap. A particular gap can be smaller or much larger than log(p). The value is there as a local reference scale, not as a deterministic forecast.
SMALL-PRIME EXCEPTION
If the selected prime itself divides the current modulus, the Status field identifies it as a small-prime exception. At M = 210, this applies to 2, 3, 5 and 7.
TRY THIS
Select 97 at M = 210. Note its residue and neighbouring gaps. Then change only the modulus to 30 or 211. The prime and its neighbours stay the same, but its modular description and visual lane change because you are asking a different residue question.
GLOBAL COUNTING
This panel steps away from the local geometry for a moment and asks a global question: how many prime numbers are there up to the current INTEGER RANGE?
WHAT DOES π(N) MEAN?
The symbol π(N) is the prime-counting function. It means “the number of primes less than or equal to N”. It is unrelated to the circle constant 3.14159…; mathematicians happen to use the same Greek letter for both.
For example, π(100) = 25 because there are exactly 25 prime numbers at or below 100. At the Prime Spring default range, π(100000) = 9592.
The value shown as EXACT π(N) comes directly from the Lab's exact prime dataset and prefix counts. It is not estimated from the appearance of the spring.
WHAT IS N / ln(N)?
The Prime Number Theorem tells us that, in a precise large-scale asymptotic sense, the number of primes up to N is approximately N / ln(N).
Here ln means the natural logarithm. The expression does not attempt to identify individual primes. It estimates the overall size of the prime population as N becomes large.
At N = 100000, the exact count is 9,592 while N / ln(N) is approximately 8,685.89. Those numbers are not equal, and they are not supposed to be exactly equal at a finite N.
WHAT DOES THE DIFFERENCE MEAN?
The third line is calculated as π(N) - N/ln(N): exact count minus approximation.
A positive value means the simple N / ln(N) approximation is below the exact count at that N. A negative value would mean it is above it. The sign is displayed explicitly so the direction of the error is not hidden.
WHAT CHANGES IT?
INTEGER RANGE changes all three values because it changes N. TURN MODULUS, spring shape, camera angle, PRIME SIZE, SPIRAL OPACITY and UNROLL do not change π(N) when N itself is unchanged. Those controls alter representation or modular organisation, not which integers in the interval are prime.
WHAT TO NOTICE
Move INTEGER RANGE slowly from a small value towards 500,000 and watch the exact count and the approximation grow together. The important mathematical statement is not that their raw numerical difference must become small. The Prime Number Theorem concerns their relative large-scale behaviour: π(N) is asymptotic to N / ln(N).
This panel therefore connects the finite Prime Spring experiment to one of the central questions in prime-number theory: not where each individual prime appears, but how the whole population grows.
LOCAL VERSUS GLOBAL
PRIME PROBE is local: it tells you about one chosen prime, its neighbours, residue and nearby gaps. GLOBAL COUNTING is global: it summarises the entire interval from 1 to N. Both can be useful at the same time, but they answer different questions.
TRY THIS
Set N to 100, then 1,000, 10,000, 100,000 and 500,000. Keep the other controls alone. Compare the exact prime count with N / ln(N) at each scale. Then change TURN MODULUS or switch to UNROLL without changing N and notice that the counting values stay fixed: the representation changed, but the prime population did not.
VIEW / ROTATION / ZOOM / UNROLL
The VIEW controls change how the same current mathematical state is represented. They do not change the prime dataset, the current integer range, the modulus, the active PRIME / RESIDUE / SIEVE lens or the selected prime.
3D, TOP AND SIDE
3D returns to the standard perspective spring. TOP looks exactly along the spring axis, which can make angular residue lanes appear as radial spokes. SIDE gives an exact elevation, making the vertical development of the spring easier to inspect.
These are different projections of the same spatial object. A line that overlaps another line in one projection may separate in another.
UNROLL
UNROLL is different: it is not another camera angle. It opens the helical representation into a flat modular map.
The vertical direction still follows integer order from the beginning of the active range at the bottom towards N at the top. The horizontal direction separates the residue lanes created by the current modulus M.
The Lab cuts the spring at its natural sequence seam, so the displayed lane order from left to right is residues 1, 2, 3, …, M−1, 0. The arithmetic residue itself is still the ordinary value n mod M; this ordering simply preserves the spring's existing angular alignment as it is opened flat.
The prime dots are the same prime identities that were present in 3D. RESIDUE and SIEVE therefore become vertical modular columns rather than angular spokes or 3D guide lines. A selected prime remains selected.
REPRESENTATION VERSUS FACT
UNROLL is especially useful for seeing what the spring geometry is doing. A pattern that looked curved or helical can become a set of straight residue columns. That does not reveal a new set of primes; it reveals the same arithmetic relationship in a coordinate system that makes modular structure easier to read.
BOTTOM RADIUS, TOP RADIUS, AXIAL STRETCH and 3D rotation do not distort the flat UNROLL map. Their values are preserved so that your spatial spring is still there when you return to 3D, TOP or SIDE.
FREE ROTATION
In the spatial views, drag with a mouse or one finger to rotate the spring freely. Prime Spring stores that spatial orientation as a quaternion. Quaternions are a robust way of composing rotations without the awkward singularities that can arise if three Euler angles are used as the underlying state.
The displayed X, Y and Z angles are therefore telemetry: a human-readable description of spatial orientation, not the canonical storage format. UNROLL has no meaningful 3D orientation, so the rotation readout correctly reports that rotation is not applicable there.
ZOOM
In 3D, TOP and SIDE, use the mouse wheel or a pinch gesture to zoom. Zoom changes the camera scale only. UNROLL instead fits its modular map directly to the available viewport, so wheel and pinch camera zoom are deliberately not applied to the flat map.
RESET
RESET restores the default 3D view and default spring shape. In the present instrument it also returns the mathematical lens to PRIMES and clears the selected prime. The turn modulus itself is preserved.
TRY THIS
Choose M=210 and RESIDUE. Look first in 3D, then TOP, then UNROLL. The same 48 prime-compatible residue classes are being described each time. What changes is only the geometry through which you are seeing them.
AUTOMATIC MOTION
PLAY starts a deliberately slow, deterministic tour through several Prime Spring parameters. It is designed to help you notice how strongly the appearance of the object depends on choices such as range, modulus, shape, orientation and zoom.
WHAT MOVES
During automatic motion the Lab gradually changes INTEGER RANGE, TURN MODULUS, spring geometry, orientation and zoom. Expensive structural changes are deliberately updated less often than the smooth camera and shape motion so the experience remains responsive.
PRIME SIZE, SPIRAL OPACITY and the mathematical LENS remain available while the tour is running. This lets you change how the moving state is being inspected without fighting the parameters that PLAY itself is controlling.
WHAT PLAY IS NOT
PLAY is not a prime-search algorithm. It is not hunting for a proof, an anomaly or a hidden law. It does not alter the prime dataset. It simply moves through a predetermined part of the instrument's parameter space.
WHY A SELECTED PRIME CLEARS
Automatic motion can change the active integer range and modulus. A previously selected prime might move outside the visible range or acquire a different residue description, so starting PLAY deliberately clears the probe selection rather than leaving stale inspection state on screen.
PAUSE AND TAKE OVER
PAUSE freezes the tour at its current continuous state. You can then drag, zoom, choose a named view, alter controls or probe a prime manually. Direct manipulation also takes priority over autoplay where appropriate.
TRY THIS
Choose RESIDUE, start PLAY and watch how the residue skeleton changes as M travels. Then pause near a visually striking state and inspect it manually. The useful question is not only “what pattern do I see?” but also “which current parameter makes that pattern line up?”
DRAG TO ROTATE · WHEEL/PINCH TO ZOOM
Prime Spring. Integers 1 to 100000. 9592 primes shown. 210 integers per turn. 48 of 210 residue lanes are coprime to 210. Prime point size 0.80 times. Profile CONE. View 3D.
PRIMES: each visible point is an actual prime from the current integer range.
RESIDUE: residue guides classify integer positions modulo the current turn modulus. A prime-compatible lane is coprime to the modulus; that does not mean every number on the lane is prime.
SIEVE: the staged lens removes residue lanes divisible by the distinct prime factors of the modulus. Primes that divide the modulus itself are finite small-prime exceptions and remain visible.
If a prime p divides M, p itself remains prime even though its residue lane is removed by that sieve factor. Multiples further along the lane are not candidates after that factor is applied.