Mathematics can be used to model computing systems.
The equation below models the state machine above as a recursive
function. The function single-step
determines the next
state as a function of the current one. The equation is written in
Lisp.
(mc s n)
=
(if (zp n)
s
(mc (single-step s) (- n 1)))