The sequence above is too simple, but with just a tiny modification, it can be made much more interesting. The following sequence can work quite well.
Choose a (usually large) prime number
and two integers
and
. In addition, choose a ``seed'', or starting number for
the random sequence which we will call
such that
.
Here is the formula for
, if
:
So, for example, if
,
, and
, and
we begin with
, we generate the following sequence:
As an exercise, try to decode the following message based on
,
, and
, but with the starting
value
. We will use the random sequence in the same
way we did above--we converted our message to numbers between
10 and 99 using the table in Section 5, then
we added successive keys and took the result modulo 100.
Here is the resulting encoded message:
23, 52, 85, 91, 15, 06, 53, 61, 30, 72, 23
To get you started, the first number in the sequence is zero,
so
, so the first number decodes as
,
so the first letter in the message is ``M''. Then