To show that every series has a period of no more than four, I will show that the fourth term in the series has to be equal to the seed, or R(4)=seed. To begin with. notice that any number from 0 to 16 can be written as 4n + b where n and b are 0, 1, 2, or 3. Thus:
R(1) = 5*seed mod 16
R(1) = (4 + 1)(4n + b) mod 16
R(1) = (16n +4n +5b) mod 16
Since the 16n is an integer multiple of 16 it contributes nothing to the modulus, and we are left with:
R(1) = (4n +5b) mod 16
While both 4n and 5b are less than 16, their sum may, in general, be more. Thus the modulus can be written as:
R(1) = 4n + 5b - 16a
Where a=1 if 4n + 5b > 16 and is 0 otherwise. We can now find the second term:
R(2) = (4 + 1)(4n + 5b - 16a) mod 16
R(2) = (16n +4n + 20b + 5b - 5*16a) mod 16
R(2) = ( 16n + 16b + 4n + 4b + 5b - 5*16a) mod 16
The first two and the last term are all integer multiples of sixteen, thus their modulus is zero and we are left with:
R(2) = (4n + 4b + 5b) mod 16
Again, although each individual term in this sum is less than sixteen, their sum may not be. Thus to represent the modulus we must include a term that will bring the total to be less than sixteen.
R(2) = 4n + 4b + 5b - 16a
where a is an integer whose value need not be specified because, as has been demonstrated previously, it will fall out when we take the mod 16 in the next step. We are now ready to find the third element in the series and continue as before:
R(3) = (4 + 1)(4n +4b + 5b - 16a) mod 16
R(3) = (16n +16b + 20b - 5*16a + 4n + 4b + 5b) mod 16
R(3) = (16n +16b + 16b - 5*16a + 4n + 4b + 4b + 5b) mod 16
R(3) = (16n + 2*16b - 5*16a + 4n + 8b + 5b) mod 16
Dropping the integral multiples of sixteen as before gives:
R(3) = (4n + 8b + 5b) mod 16
As before the modulus gives us a - 16a term leaving:
R(3) = 4n + 8b + 5b - 16a
Now we use this to find the fourth term:
R(4) = (4 + 1)(4n + 8b + 5b - 16a) mod 16
R(4) = (16n + 32b + 20b - 5*16a + 4n + 8b + 5b) mod 16
R(4) = (16n + 2*16b + 16b - 5*16a + 4n + 8b + 4b + 5b) mod 16
R(4) = (16n + 3*16b - 5*16a + 4n + 17b) mod 16
R(4) = (16n + 4*16b - 5*16a + 4n + b) mod 16
Again we can drop the integral multiples of 16:
R(4) = (4n + b) mod 16
But 4n + b = seed, which is less than 16, so the modulus is simply:
R(4) = 4n + b = seed
Thus the fourth term is equal to the original seed, and the series must begin again. Hence the series repeats with a period of four. Since this was done for any possible seed, we know that all series produced from this algorithm have a maximum period of four.