yAtlas

Drawing the first frame…

0:00 / 7:17Prologue

The Order Beneath · No.05 · Rendered in real time · 7:17

Arithmetic

A short film about number theory

Number theory in five short chapters. Multiply, add, take the remainder, keep counting: lay the whole numbers out by these few rules and order shows itself, in a heart drawn by straight chords, triangles within triangles, the spirals of a sunflower, the arms of whole numbers; even the primes, which seem to follow no rule at all, have their places written in the zeros of the zeta function. Every frame is computed by code; on the website, each one is drawn live in your browser as the film plays.

Runtime
7:17
Chapters
Five, with a prologue and a coda
Resolution
Matches the player, up to 4.4 MP
Frame rate
Up to your display’s refresh rate, depending on the device
Prerecorded frames
None
Languages
中文 · English

Try it yourself

Each of these moments in the film opens in the Studio, where you can try the idea yourself.

  1. Drag the multiplier slowly from 3 to 4 and see where the curve splitsI · Times tables
  2. Count the hearts near 242, 162 and 122I · Times tables
  3. Switch primes and watch the triangle splitII · Pascal's triangle
  4. Set the angle back to 137.5, then nudge Fine a tenth of a degree off and watch the flower splitIII · The golden angle
  5. Raise Numbers up to and count the armsIV · Prime spirals
  6. Switch to Sacks's spiral and see what the diagonals becomeIV · Prime spirals
  7. Add zeros pair by pair until the steps showV · Primes from zeros
  8. Drag the line to compare the steps with the gold curveV · Primes from zeros

Chapters

Studio

This volume's pictures, in your hands: change a parameter and watch the picture follow.

Where it turns up

Places in the world where this volume's mathematics turns up. Each card links to a related Studio.

Transcript · 66
  1. Prologue

  2. ITimes tables

  3. IIPascal's triangle

  4. IIIThe golden angle

  5. IVPrime spirals

  6. VPrimes from zeros

  7. Coda

Plate notes · 5

I Times tables

Number the points of a circle from 0 to n−1 and draw a chord from every k to mk, counting round the circle, so modulo n. Each chord is one line of a times table; together they bend into the curve they all touch, their envelope. For m=2 it is a cardioid, for m=3 a nephroid, and for every m an epicycloid with m−1 cusps. The chords are drawn by the GPU as hairlines of light that add up where they overlap, so the envelope shines. In the corner the chord under the gold highlight is worked out in digits.

Doubling
k↦2kmodnTen points and the chords 1→2, 2→4, 3→6, and on round the circle: 6→12, which is 2 modulo 10. As the points multiply, the chords close in on a heart-shaped curve, the cardioid, which touches the circle at 0 and has its one cusp on the far side, a third of the way out from the centre.
Every multiplier
k↦mkmodnWith 480 points the multiplier walks from 2 to 10, and not only through whole numbers: between them the envelope is torn open at 0, where its next cusp is growing. When the multiplier is a whole number m, the envelope closes into an epicycloid with m−1 cusps, the curve traced by a point on the rim of a wheel rolling round the outside of a fixed circle.
Resonance
m=n/q+2Some large multipliers draw small ones several times over. If m=n/q+2, then mk is 2k plus k q-ths of a turn, so the chords fall into q families by the remainder of k modulo q, each one the doubling table turned a q-th of a turn further than the last: 242, 162, 122, 98 and 82 draw two, three, four, five and six cardioids.
A coffee cup
θ↦2θ→θ↦3θ+πA lamp on the rim of a cup: a ray from it that strikes the wall at the angle θ is reflected to strike it again at 2θ, so the reflected rays are the doubling table and their envelope, the caustic on the coffee, is a cardioid. As the lamp moves away the rays turn parallel, and sunlight, all parallel, is reflected from θ to 3θ+π, the tripling table turned a quarter of a turn: half a nephroid, the curve you see in a real cup.

II Pascal's triangle

Row n of Pascal's triangle lists the binomial coefficients nk, the number of ways to choose k things out of n. Here each one is a cell, lit by its remainder modulo a prime p, computed for every pixel from the digits of n and k in base p. When the cells are smaller than a pixel, the digits that are too fine to see are averaged, so the triangle can be as many rows deep as you like. In the corner the cell under the gold ring is worked out digit by digit.

Odd and even
nk=n−1k−1+n−1kEight rows, and the odd numbers light up. Odd plus odd is even, so the parity of each cell follows from the two above it, and as the rows multiply the odd ones draw Sierpiński's triangle: three copies of the first 2j rows make the first 2j+1.
Other primes
nk≡ΠnikimodpLucas's theorem: write n and k in base p, and the remainder of nk is the product of the small binomials of their digits, zero as soon as a digit of k is larger than the digit of n. The colour of a remainder is its discrete logarithm, so 1 is gold, −1 is blue, and multiplying remainders adds their colours' angles.
Carries
vpnk=carries in k+(n−k)Kummer's theorem: the number of times p divides nk is the number of carries when k and n−k are added in base p. Gold cells are not divisible by p at all, and each further colour is one more carry, so the triangles that were dark fill with finer and finer structure.
No bottom
#{oddnk:n<2j}=3jThe rows keep coming, doubling every three seconds, and the picture never changes: each doubling of the rows is three copies of the triangle before, which is why the first 2j rows hold 3j odd numbers. Then the rows fall back to eight.

III Prime spirals

The primes are fixed by the simplest rule there is, and still nobody can say, without checking, where the next one falls. Laid out on a spiral they fall into patterns that come from arithmetic just as simple: which quadratics can take prime values, and which remainders. Every prime up to a million is a point drawn by the GPU from a sieve; in the corner the number under the gold ring is factorised, or the race between remainders is scored.

Ulam's spiral
4k2+bk+cWrite 1 in the middle, wind the counting numbers round it in a square spiral, as Stanisław Ulam did in 1963 while doodling through a long talk, and light the primes. They crowd onto diagonal lines: each diagonal is a quadratic 4k2+bk+c, and some quadratics are rich in primes while others, which factor, have one or two at most.
Sacks's spiral
r=n1/2,θ=2πn1/2Robert Sacks's spiral of 1994 puts n at radius n1/2 and angle 2πn1/2, so that the squares fall on one line and every quadratic draws a curve. Euler's k2+k+41 is prime for every k from 0 to 39; at k=40 it is 412.
Rays
2π≈44/7≈710/113Put n at radius n and angle n radians. Close in, the integers wind into six spirals, because six radians is just short of a turn; further out into forty-four, because 44 radians is just over seven turns; and furthest out into 710 rays, because 710/113 is 2π to seven digits. Apart from the few primes that divide the number of arms, the primes keep to the arms whose remainder shares no factor with it: two of six, twenty of forty-four, 280 of 710.
A race
π(x;4,3)−π(x;4,1)Dirichlet proved that each remainder the primes are allowed receives infinitely many of them, and de la Vallée Poussin that in the long run each receives its fair share. It is a close race with a favourite all the same: primes that leave 3 on division by 4 stay ahead of those that leave 1 almost all the time, and first fall behind at 26,861. The primes are drawn again in order of size, gold for 1 and blue for 3, while the corner keeps the score.

IV The golden angle

A sunflower lays down its florets one at a time, each a fixed fraction of a turn past the last. Helmut Vogel's model of 1979 puts seed n at angle 2πnα and radius cn1/2, so that the seeds fill the disc at an even density. What the pattern looks like depends only on how closely fractions approximate α, which its continued fraction tells: a fraction makes spokes, and 1/φ2, whose continued fraction is nothing but ones after its first two terms, makes none at any scale. The 1,200 seeds are points drawn by the GPU; the corner writes out the angle and the arithmetic of the spirals.

A fraction of a turn
θn=2πnα,rn=cn1/2If α is a fraction p/q in lowest terms, seed n+q lands exactly where seed n did, only further out, so the seeds line up on q straight spokes: 1/2, 1/3, 2/5, 3/8, 5/13, 8/21 and 13/34, the fractions that close in on the golden angle. Between them the spokes bend into spirals.
The golden angle
α=1/φ2≈0.381966At α=1/φ2, which is 137.508°, no seed ever lands in the direction of an earlier one, and each new seed goes into the widest gap left. The seeds are lit in the order they arrive, each 137.5° past the one before.
Fibonacci spirals
1/φ2=[0;2,1,1,1,⋯]Seeds whose numbers differ by a Fibonacci number F sit almost in line, because F times the golden angle is very nearly a whole number of turns. Coloured by n modulo 8, 13, 21, 34 and 55 they fall into that many spirals, the counts found on real sunflowers and pine cones.
Near misses
360°/φ2≈137.508°Change the angle by a tenth or two of a degree and the packing breaks: 137.3° and 137.6° each lie close to a fraction with a small denominator, and gaps open between the arms. Then the angle runs back through the fractions to 1/2.

V Primes from zeros

Count the primes with a weight, lnp for every prime power pk up to x, and you get Chebyshev's staircase ψ(x), which climbs about as fast as x itself. Riemann's paper of 1859 led to an exact formula for it, proved by von Mangoldt in 1895: the staircase is x, minus one wave for each nontrivial zero ρ of the zeta function, minus two small corrections (at a step itself, the formula gives the value halfway up the step). Here the first 500 pairs of zeros, found on the critical line, rebuild the staircase, each pair a wave that grows like x1/2 and oscillates at the height γ of its zero. Above it the critical strip is coloured by the argument of ζ, and the zeros are the points where every colour meets.

Counting primes
ψ(x)=Σpk≤xlnpThe staircase climbs ln2 at 2, ln3 at 3, ln2 again at 4=22, and so on at every power of a prime. The prime number theorem says that it keeps close to the diagonal ψ(x)=x, but not how close.
A pair at a time
ψ(x)=x−Σρxρ/ρ−ln2π−½ln(1−x−2)Start from the smooth part, x−ln2π−½ln(1−x−2), and subtract the wave of the first zero, ρ=1/2+14.134725i, with its mirror image 1/2−14.134725i: the gold curve begins to sway round the steps. Each further pair adds a faster wave, and ten of them already find most of the steps.
Five hundred pairs
ρk=1/2+iγk,k=1,2,⋯,500With 500 pairs, up to γ=811.18, the gold curve has all but become the staircase, overshooting each step a little as a Fourier series does at a jump. Everything there is to know about where the primes fall is held by the zeros.
The critical line
Z(t)=eiθ(t)ζ(1/2+it)Hardy's Z(t) is real on the line Res=1/2 and changes sign at each zero shown on it. Riemann guessed that every zero in the strip lies on this line. More than 1013 of them have been checked, and it has never been proved.