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.

214<br />

appendix<br />

so<br />

but<br />

so<br />

Hence<br />

1�6�1�(17�2�6)�3�6�17<br />

6�91�5�17<br />

1�3�(91�5�17)�17�3�91�16�17.<br />

m�3 <strong>and</strong> n�16.<br />

(Check: 3�91�273 <strong>and</strong> 16�17�272.)<br />

An alternative method<br />

The values of m <strong>and</strong> n can also be found by using continued fractions [6.7].<br />

Although it looks different <strong>the</strong> method is essentially <strong>the</strong> same as that of<br />

<strong>the</strong> Euclidean Algorithm.<br />

To illustrate <strong>the</strong> method we again find <strong>the</strong> values of m <strong>and</strong> n such that<br />

91m�17n�1.<br />

91 6<br />

�5� ,<br />

17 17<br />

17 5<br />

�2� ,<br />

6 6<br />

6 1<br />

�1� .<br />

5 5<br />

The partial quotients of <strong>the</strong> continued fraction are <strong>the</strong>refore (5, 2, 1, 5) <strong>and</strong><br />

its convergents are<br />

5 11 16 91<br />

, , , <strong>and</strong> .<br />

1 2 3 17<br />

The numbers m <strong>and</strong> n are <strong>the</strong> numerator <strong>and</strong> denominator of <strong>the</strong> penultimate<br />

convergent: 16 <strong>and</strong> 3, as we found before.<br />

M26 Efficiency of finding powers by repeated squaring<br />

Given a number, X, that we wish to raise to <strong>the</strong> power n we could compute<br />

X n by multiplying X by itself (n�1) times. If n is small this is reasonable<br />

but if n is large it is very inefficient. Let k be such that<br />

2 k �n�2 (k�1) ;

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

Saved successfully!

Ooh no, something went wrong!