For m a prime number and c = 0, the
longest possible period is P = m - 1 when a satisfies the
property that the smallest k such that is divisible by
m is k = m - 1.
For example, we choose m = 7 and a = 3, the above
conditions satisfy. Here k has to be 6.
- when k = 6, which is divisible by m
- when k = 5, which is not divisible by m
- when k = 4, which is not divisible by m
- when k = 3, which is not divisible by m
Of course, the longest possible period here is 6, which is of no
practical use. But the example shows how the conditions can be checked.