09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

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.

16 RECURRENT PROBLEMS<br />

For example, when n = 100 = (1100100)~, our original Josephus values<br />

LX=], /3=-l,andy=l yield<br />

n= (1 1 0 0 1 0 O)L = 100<br />

f(n) = ( 1 1 -1 -1 1 -1 -1)1<br />

=+64+32-16-8+4-2-l = 73<br />

as be<strong>for</strong>e. The cyclic-shift property follows because each block of binary digits<br />

(10 . . . 00)~ in the representation of n is trans<strong>for</strong>med into<br />

(l-l . . . -l-l)2 = (00 ..,Ol)z.<br />

,<br />

So our change of notation has given us the compact solution (1.16) to the There are two<br />

general recurrence (1.15). If we’re really uninhibited we can now generalize<br />

even more. The recurrence<br />

kinds Ofgenera’-<br />

izations. One is<br />

cheap and the other<br />

f(i) = aj<br />

f(dn + j) = cf(n) + (3j ,<br />

<strong>for</strong> 1 < j < d;<br />

<strong>for</strong>O

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

Saved successfully!

Ooh no, something went wrong!