Category Archives: Uncategorized

Digits of pi and Python generators

Introduction This post was initially motivated by an interesting recent article by Chris Wellons discussing the Blowfish cipher. The Blowfish cipher’s subkeys are initialized with values containing the first 8336 hexadecimal digits of , the idea being that implementers may … Continue reading

Posted in Uncategorized | 2 Comments

Floating-point agreement between MATLAB and C++

Introduction A common development approach in MATLAB is to: Write MATLAB code until it’s unacceptably slow. Replace the slowest code with a C++ implementation called via MATLAB’s MEX interface. Goto step 1. Regression testing the faster MEX implementation against the … Continue reading

Posted in Uncategorized | 3 Comments

What is (-1&3)?

This is just nostalgic amusement.  I recently encountered the following while poking around in some code that I had written a disturbingly long time ago: What does this code do?  This is interesting because the switch expression is a constant … Continue reading

Posted in Uncategorized | 2 Comments

The following are equivalent

I have been reviewing Rosen’s Discrete Mathematics and Its Applications textbook for a course this fall, and I noticed an interesting potential pitfall for students in the first chapter on logic and proofs. Many theorems in mathematics are of the … Continue reading

Posted in Uncategorized | 4 Comments

Dice puzzle

I recently encountered the following interesting problem: Suppose that I put 6 identical dice in a cup, and roll them simultaneously (as in Farkle, for example).  Then you take those same 6 dice, and roll them all again.  What is … Continue reading

Posted in Uncategorized | 2 Comments

A number concatenation problem

Introduction Consider the following problem: given a finite set of positive integers, arrange them so that the concatenation of their decimal representations is as small as possible.  For example, given the numbers {1, 10, 12}, the arrangement (10, 1, 12) … Continue reading

Posted in Uncategorized | 4 Comments

Cutting crown molding

This post captures my notes on how to determine the miter and bevel angles for cutting crown molding with a compound miter saw.  There are plenty of web sites with tables of these angles, and even formulas for calculating them, but … Continue reading

Posted in Uncategorized | Leave a comment