O'Reilly logo

Digital Dice by Paul J. Nahin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

image

8. A Toilet Paper Dilemma

The code rolls.m uses Knuth’s recurrence formulas to directly calculate and plot M200(p). This program can be most easily understood by referring to Figure S8.1, which again shows the underlying lattice point structure of the problem. The one complication MATLAB itself, as a programming language, introduces is that it does not allow zero indexing of arrays. If your favorite language does, then rolls.m will still work, but you could, if you wanted, actually rewrite the program with fewer commands. As you can see, however, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required