Random Numbers Part 2: Residues, Groups, and the ZX Spectrum
It’s interesting how simple random number generators in computers such as the 1982 ZX Spectrum are:
\(X_{n} = 75^n \pmod{65537}\)
The nth term is equal to 75 to the power of n, modulo 65537. The first few terms are:
| Index | Term |
|---|---|
| 0 | 1 |
| 1 | 75 |
| 2 | 5,625 |
| 3 | 28,653 |
| 4 | 51,791 |
| 5 | 17,642 |
| 6 | 12,410 |
| 7 | 13,232 |
| 8 | 9,345 |
| 9 | 45,505 |
| 10 | 4,951 |
There are 65536 terms in the sequence, before it resets and repeats from the beginning again. The ‘randomness’ is introduced by the modulus we’re working under - each time the power of 75 exceeds 65537, we wrap around and land somewhere “unexpected”.