TAOCP 3.2.1.3 Exercise 1

Let $a=B^2+1$, so that $b=a-1=B^2$.

Section 3.2.1.3: Potency

Exercise 1. [M10] Show that, no matter what the byte size $B$ of MIX happens to be, the code (3) yields a random number generator of maximum period.

Verified: yes
Solve time: 1m19s


Let $a=B^2+1$, so that $b=a-1=B^2$. The code (3) therefore implements the recurrence

$X_{n+1}\equiv (aX_n+1)\pmod{B^5},$

since a MIX word contains five bytes and the modulus is $m=B^5$.

By Theorem 3.2.1.2A, a mixed congruential generator has maximum period $m$ if and only if $c=1$, $b$ is divisible by every prime dividing $m$, and $b$ is divisible by $4$ whenever $m$ is divisible by $4$. Here $m=B^5$, and every prime dividing $m$ divides $B$. Since $b=B^2$, every prime dividing $m$ divides $b$. Furthermore, if $4\mid m$, then $4\mid B$, hence $4\mid B^2=b$. Thus all conditions of Theorem 3.2.1.2A are satisfied for every possible byte size $B$ of MIX. Consequently the generator produced by code (3) has period

$m=B^5,$

which is the maximum possible period. Therefore code (3) yields a random number generator of maximum period, regardless of the value of $B$.

$$ \boxed{\text{The generator defined by (3) has maximum period } B^5 \text{ for every byte size } B.} $$