30.11.2012 Views

Code and ciphers: Julius Caesar, the Enigma and the internet

Code and ciphers: Julius Caesar, the Enigma and the internet

Code and ciphers: Julius Caesar, the Enigma and the internet

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Linear recurrences<br />

The sequences looked at above are examples of sequences generated by<br />

means of what are known as linear recurrences. Since each new term<br />

involved adding toge<strong>the</strong>r multiples of <strong>the</strong> two preceding terms <strong>the</strong>y are<br />

more specifically known as linear recurrences of order 2. More generally, a<br />

linear recurrence of order k is one in which each new term is <strong>the</strong> sum of multiples<br />

of <strong>the</strong> k preceding terms. So, for example, if we let U n denote <strong>the</strong> nth<br />

term of a sequence <strong>the</strong>n<br />

U n �U (n�1) �2U (n�2) �U (n�3)<br />

is a linear recurrence of order 3 <strong>and</strong><br />

U n �U (n�3) �U (n�5)<br />

is a linear recurrence of order 5. The fact that in <strong>the</strong> second case some of <strong>the</strong><br />

preceding terms are not involved doesn’t matter; five preceding terms are<br />

required in order to find <strong>the</strong> next term but three of <strong>the</strong> terms, U (n�1) , U (n�2)<br />

<strong>and</strong> U (n�4) , have multipliers of 0. Had <strong>the</strong> term U (n�5) not been present<br />

however <strong>the</strong> recurrence would not have been of order 5. The multipliers,<br />

for our purposes, are always integers but may be positive, negative or zero.<br />

It is assumed that in a linear recurrence of order k <strong>the</strong> term U (n�k) is<br />

present, with ei<strong>the</strong>r a positive or a negative multiplier, but not zero.<br />

The terms of linear recurrences usually grow very rapidly <strong>and</strong><br />

although <strong>the</strong>y often have interesting arithmetical properties <strong>the</strong>y are<br />

only suitable for cryptographic purposes when <strong>the</strong> terms <strong>the</strong>mselves are<br />

replaced by <strong>the</strong>ir values (mod 2), that is <strong>the</strong> terms are replaced by 0 if <strong>the</strong>y<br />

are even <strong>and</strong> by 1 if <strong>the</strong>y are odd, thus producing a binary sequence.<br />

Calculation of <strong>the</strong> terms of a linear recurrence (mod 2) is particularly easy,<br />

<strong>the</strong>re is no need to compute <strong>the</strong> actual value of <strong>the</strong> terms <strong>and</strong> <strong>the</strong>n replace<br />

<strong>the</strong>m by 0 or 1. Each term is simply replaced by 0 or 1 as soon as it is calculated;<br />

we <strong>the</strong>n only have to add up a number of 0s <strong>and</strong> 1s which is a lot<br />

easier than adding increasingly large integers. The resulting binary<br />

sequence is identical to <strong>the</strong> one which would be obtained by computing<br />

each term exactly <strong>and</strong> <strong>the</strong>n replacing it by 0 or 1. So, for example, <strong>the</strong><br />

linear recurrence of order 2<br />

U n �3U (n�1) �2U (n�2)<br />

with <strong>the</strong> initial values U 0 �0, U 1 �1 continues<br />

0, 1, 3, 7, 15, 31, 63, 127, 255, 511,.....<br />

Producing r<strong>and</strong>om numbers <strong>and</strong> letters 99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!