MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

The modular clock

A dial of m marks and one hand. Adding a step draws a star that closes after m/gcd(s, m) moves; multiplying draws a cycle whose length divides phi(m). Some moduli have no primitive root at all, and the card says so - that is a theorem, not a failed search.

The modular clock — Actual application image
Actual application image

What happens

The hand moves one step at a time and the marks it touches light up; the ones that stay dark answer the question before the panel names the gcd. Adding 8 on a dial of 12 draws a triangle and lights three marks; adding 5 draws a star and lights all twelve, because 5 and 12 share no factor. The closed figure is the result, so it stays on screen instead of being wiped. Switch to multiplying and the rule changes: the hand goes k → k·g, the cycle length is the ORDER of g, and Euler's theorem says that order must DIVIDE phi(m) - on a dial of 17 the only lengths that can occur are 1, 2, 4, 8 and 16. A step whose order is exactly phi(m) is called a primitive root, and on a prime dial it walks every non-zero mark: that is the task of this card. How many such steps are there? Exactly phi(phi(m)) - two for 7, four for 11, ten for 23 - and the panel counts them by brute force as well, so the formula and the search agree in front of you. And then the part worth staying for: primitive roots do not exist for every modulus. They exist only for 1, 2, 4, p^k and 2p^k, so on a dial of 8, 12, 15, 16, 20, 21 or 24 there is none at all. The card says that out loud instead of quietly finding nothing, because 'there is no answer' is a different statement from 'I did not find one'.

Equations used in the module
Equations
adding:  the hand at position k moves to k + s (mod m);  the cycle closes after m / gcd(s, m) moves and visits EVERY mark exactly when gcd(s, m) = 1
  m = 12, s = 8 → 3 marks (a triangle);  m = 12, s = 5 → all 12;  m = 360, s = 84 → 30
multiplying:  k → k·g (mod m);  the cycle length is the ORDER of g, and by Euler's theorem it divides phi(m)
  m = 17: phi = 16 and the orders present are 1, 2, 4, 8, 16 - nothing else can occur
a primitive root is a g whose order IS phi(m); for a prime m that means a cycle through all m − 1 non-zero marks
how many:  exactly phi(phi(m)) when they exist -  m = 7 → 2 (smallest 3), m = 11 → 4 (smallest 2), m = 23 → 10 (smallest 5)
WHEN THEY EXIST:  only for m = 1, 2, 4, p^k and 2p^k.  For 8, 12, 15, 16, 20, 21, 24 there is NO primitive root at all - a theorem, not a failed search
phi is computed here, not tabulated:  phi(7) = 6, phi(9) = 6, phi(12) = 4, phi(16) = 8, phi(36) = 12, phi(100) = 40, phi(1000) = 400

Related experiments

Back to catalogue
The sieve and the density of primes — Actual application image

Math

The sieve and the density of primes

Work the sieve by hand on numbered tiles: take the next divisor, predict where its wave starts, and watch it strike its multiples - the ones already struck are only touched. Beside it, pi(x) counted against the approximations x/ln x and Li(x).

RSA on small numbers — Actual application image

Math

RSA on small numbers

One message travels through two modular powers on a wood-and-brass desk. Execute the actual integer steps, inspect small permutations or large sampled maps, and find a divisor with a counted search.

Hashes and buckets — Actual application image

Math

Hashes and buckets

A sorting table: keys as paper tags, a carriage that hashes each one and drops it into the bin its hash names, a collision as two different keys in one bin. The hash is a named function - the sum of the codes, the base-31 polynomial, FNV-1a - or the uniform oracle behind the birthday curve. Edit a key, watch its hash computed character by character, flip one bit and count the hash bits that move; compare two functions on the same keys.