← All projects / Modulo
Modulo means what's left over after dividing. 17 modulo 5 is 2. It sounds small, but every loop on this site is a modulo in disguise: a last digit is a number modulo 10, and a digital root is a number modulo 9. This page is about what happens when several of them run at once.
Take any number modulo 3 and modulo 8. Modulo 3 says which trio it's in. Modulo 8 is its last three bits. Put the two together and you get the number modulo 24, which is an hour on a 24-hour clock. Modulo 1 is always 0, because everything divides by 1.
| Family | Modulo 3 | Modulo 8 | Hours | Rows on a prime hour |
|---|
Tap a family to see its hours on the clock. Filled hours are the eight where a prime bigger than 3 can land.
1, 5, 7, 11, 13, 17, 19 and 23. Every other hour shares a factor with 24, so every number on it divides by 2 or by 3.
The 97s sit on hour 1 for ever. The 67s swap between 11 and 19. Every row of both is on an hour where a prime can live, and they're the two original families richest in primes.
They swap between hour 9 and hour 17. Nothing on hour 9 can be prime, so half the family is gone before any search starts. The even families lose everything.
25, 49, 121, 169, 289: all one more than a multiple of 24. Hour 1 is the 97s' hour, and the 97s contain 25 and 49.
Modulo 3 only has three answers: 0, 1 and 2. Those are exactly the digits of base 3, where you count in threes instead of tens. So a number modulo 3 is just its last digit in base 3.
| A 97s number | In base 3 | The power of two inside it | That power in base 3 |
|---|---|---|---|
| 13 | 111 | 4 | 11 |
| 25 | 221 | 8 | 22 |
| 49 | 1211 | 16 | 121 |
| 97 | 10121 | 32 | 1012 |
| 193 | 21011 | 64 | 2101 |
A 97s number is 3 times a power of two, plus 1. Multiplying by 3 in base 3 just adds a 0 on the end, the way multiplying by 10 does in ordinary digits. Then the plus 1 turns that 0 into a 1. That's why the 97s are always 1 modulo 3.
In ordinary digits the last digit is modulo 10 and the digital root is modulo 9. In base 3 the last digit is modulo 3, which is the trio, and the digital root is modulo 2, which is odd or even. So base 3 shows the trio on the surface and hides odd and even inside the digit sum.
I tallied the base-3 digits of the first 3,000 numbers of the 97s, 67s, 1null1s, 0101 and 1010. In every one the digits 0, 1 and 2 each came to between 33.2% and 33.5%.
Since the 97s are powers of two in base 3, their digits are the digits of powers of two in base 3. There's an unsolved problem about exactly that: past 256, does every power of two have a 2 somewhere in its base-3 form? I checked up to 2 to the power 20,000 and the only ones without a 2 are 4 and 256. Nobody has proved it stays that way.
In base 8 you count 1, 2, 3, 4, 5, 6, 7 and then roll over. So 8 itself is written 10: a 1 and a 0. Every base-8 digit stands for exactly three bits, which is why binary patterns come out so clean in it.
| Family | Its numbers in base 8 | What you see | Last digit |
|---|---|---|---|
| Powers of two | 1, 2, 4, 10, 20, 40, 100, 200, 400 | only ever a 1, a 2 or a 4, then zeros | 0 |
| 0101 | 25, 125, 525, 2525, 12525 | 2s and 5s taking turns | always 5 |
| 1010 | 52, 252, 1252, 5252, 25252 | 5s and 2s taking turns | always 2 |
| 000111s | 7, 107, 307, 707, 10707, 30707 | 7s and 0s | always 7 |
| 111000s | 70, 1070, 3070, 7070, 107070 | 7s and 0s | always 0 |
| 1null1s | 11, 21, 41, 101, 201, 401 | a 1, 2 or 4, zeros, then 1 | always 1 |
| 67s | 13, 23, 43, 103, 203, 403 | a 1, 2 or 4, zeros, then 3 | always 3 |
| 97s | 15, 31, 61, 141, 301, 601 | 3, 6 or 14, zeros, then 1 | always 1 |
| null1nulls | 6, 16, 36, 76, 176, 376, 776 | a 1 or 3, then 7s, then 6 | always 6 |
Every power of two is a 1, a 2 or a 4 followed by zeros. Nothing else. Doubling just walks 1, 2, 4 and then the rollover adds a zero and starts again.
21 is 25 in base 8 and 42 is 52. The whole 0101 and 1010 families are 2s and 5s taking turns, and 2 and 5 are a mirror pair here: they add up to 7.
Add up digits in base 8 and double, the way the dial on the digit families page does in base 10. The loops are 1, 2, 4, then 3, 6, 5, and 7 on its own. That's my evil trio as one closed loop, 7 standing alone the way 9 does in base 10, and 8 as the rollover. In base 10 the same trio gets tangled into a loop of six with 8, 7 and 5.
The last base-8 digit is the last three bits, and every family that grows on the left keeps those fixed. So each family has one last digit for ever: 5, 2, 7, 0, 1, 3, 1 and 6. Between them they use all eight digits except 4.
In base 8 the digital root is the number modulo 7. For every family that grows on the left it runs in a loop of three: 1, 5, 7 for 0101, and 4, 5, 7 for the 67s. In base 10 the same families needed loops of two, six, nine or twenty-seven.
Up to 100,000 the primes end in 1, 3, 5 and 7 almost equally, about 2,400 each. And the next prime repeats the last digit only 14% of the time, where chance would give 25%. It's the same reluctance to repeat that showed up in base 3.
A modulo family is the simplest pattern there is: a mark on every 2nd number, or every 3rd, or every 5th. Tick the boxes to cross out one family at a time and watch what's left.
left, and primeleft, but not prime yet
Cross out the multiples of 2, 3, 5, 7, 11 and 13 and every number left under 210 is prime. This is the oldest way of finding primes there is. It's about 2,200 years old.
One family repeats every 2 places. Two of them together repeat every 6. Then 30, then 210, then 2,310, then 30,030. Each new family multiplies the wait, because the patterns only line up when every one of them comes round at once.
Every family on this site has a last-digit loop because it's built from one or two modulos. The primes are built from all of them at once, and that pattern's repeat keeps running away. So there's no loop to find.
That gives one more family: a 1 on every prime row and a 0 on every other row, adding one bit on the right each time, the same way as the Fibonacci family.
It doubles on every row that isn't prime, and doubles and adds 1 on every row that is. Every row is about 41.47% of the power of two above it. That number is called the prime constant, and it isn't a fraction, because the pattern never repeats.
On any other row the last bit is 0, so the number is even. Row 3 gives 3, row 5 gives 13 and row 7 gives 53: primes on prime rows, made of primes.
Its first primes are on rows 3, 5 and 7.
Over the first 10,000 rows every digital root from 1 to 9 turns up about 11% of the time. The Fibonacci family spends nine rows in ten on the doubling loop. This one shows no favourite at all.
Stack every modulo family on top of the others and count how many marks land on each place. Place 12 gets six, one each from the families for 1, 2, 3, 4, 6 and 12.
A place gets a mark from every number that divides it. The places with just two marks are the primes: only 1 and the number itself divide them.
As a fraction, the family that marks every 2nd place is a third, every 3rd place is a seventh, and every 4th is a fifteenth. Add the whole lot and the total settles at 1.6067. It has a name, the Erdős–Borwein constant, and it was proved in 1948 that it isn't a fraction either.
This is an old program of mine, and it's the same idea drawn. A pen moves one step at a time inside a box and bounces off the walls. Every time the step count is a multiple of the chosen number, the pen turns 15 degrees and moves one notch round the colour wheel. That's all it does.
The turning comes round every 24 turns. The colour comes round every 360. The walls flip the pen on a beat of their own. The picture is what you get while all three drift in and out of step, and that takes far longer than any one of them.
Move the number by 1 and every turn happens slightly later, so the pen meets each wall at a different point. After a few bounces the path has nothing in common with the last one. That's how one rule gave 4,232 different pictures.