3 ms·
Modular arithmetic (a.k.a. clock arithmetic) is equivalent to cycles in a very real, mathematical way. There's a reason that clocks are round -- in order to co
by groovy2shoes 10y ago
Modular arithmetic (a.k.a. clock arithmetic) is equivalent to cycles in a very real, mathematical way. There's a reason that clocks are round -- in order to count the naturals modulo 12 (and again modulo 60), you simply need to cycle 1..12 (or 1..60). I'd argue that for anyone who understands modular arithmetic, the `cycle` solution doesn't seem particularly clever. Anyone with enough knowledge of number theory to understand that "x is a multiple of y" -> "y divides x" -> "x (mod y) = 0" ought to have an understanding of the relationship between modular arithmetic and cycles. This is introductory-level discrete mathematics.