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.

3.4 ‘MOD’: THE BINARY OPERATION 85<br />

n’ = qm’ things to put into the remaining m’ = m - 1 groups. And if<br />

r > 0, we put [n/ml = q + 1 things into the first group and replace n<br />

by n’ = n - q - 1, leaving n’ = qm’ + T - 1 things <strong>for</strong> subsequent groups.<br />

The new remainder is r’ = r - 1, but q stays the same. It follows that there<br />

will be r groups with q + 1 things, followed by m - r groups with q things.<br />

How many things are in the kth group? We’d like a <strong>for</strong>mula that gives<br />

[n/ml when k < n mod m, and Ln/m] otherwise. It’s not hard to verify<br />

that<br />

has the desired properties, because this reduces to q + [(r - k + 1 )/ml if we<br />

write n = qm + r as in the preceding paragraph; here q = [n/m]. We have<br />

[(r-k+ 1)/m] = [k

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

Saved successfully!

Ooh no, something went wrong!