As I, like many South Indians, don’t have a surname, and have been forced to adopt one for my life in the US, I have some things to say about surnames, and there will be a post about them someday, probably. (There was a draft lying around which had “tyranny” in its title, but nothing much good besides.) In the meantime, someone very bored might be able to amuse themselves with related news I’ve been collecting, such as this latest one from a BBC article on zombies:

In their study, the researchers from the University of Ottawa and Carleton University (also in Ottawa) posed a question: If there was to be a battle between zombies and the living, who would win?

Professor Robert Smith? (the question mark is part of his surname and not a typographical mistake) and colleagues wrote: “We model a zombie attack using biological assumptions based on popular zombie movies. [..]

Some paragraphs later:

Professor Smith? told BBC News:

(Apparently he’s an Australian citizen and got his name changed while living in the US… quite an achievement. His major complaint seems to be that Facebook won’t let him use his name.)

If you came here because you were reading Peter Winkler’s “7 Puzzles You Think You Must Not Have Heard Correctly”, the names are supposed to be Eugene Curtin and Max Warshauer, and the paper is called “The locker puzzle”, published in The Mathematical Intelligencer, Volume 28, Number 1 (March 2006), pages 28–31.
[If not, you should read the amazing “7 Puzzles You Think You Must Not Have Heard Correctly”, spend several days trying the first problem, read the brilliant solution, and then come back here if you’re interested in learning why no other solution can do better.]

The paper is available here if your institution has access. If not, here’s a sketch of the proof that the strategy cannot be improved upon. [Update 2010-01-06: Oliver Nash has a post about the puzzle, explaining both the original solution and the proof of optimality, here. Just the original solution is also worked out by David MacKay here.]

First, let us modify the rules slightly so that each prisoner must continue looking in boxes until he finds the box containing his name. The prisoners win if no prisoner opens more than 50 (i.e., n/2) boxes. This change obviously makes no difference to the outcome. Let’s call this (modified) game Game 1.

A different game involves all the prisoners being in the room at the same time, and is played as follows. The first prisoner opens boxes until he finds his name (i.e., the number “1”). Then, the lowest-numbered prisoner whose name hasn’t been revealed starts opening boxes until he finds his name. Then the next lowest-numbered whose name hasn’t been revealed opens boxes, and so on. The prisoners win if no one opens more than 50 boxes. Call this Game 2.

Let’s say we observe the prisoners as they play Game 2, and record the order in which boxes were revealed. This completely specifies what happened. For example, (with 10 prisoners instead of 100) if we record the list 2,6,1,4,9,7,10,8,3,5, we know that the first prisoner revealed boxes containing 2, 6, 1, then the third (lowest unrevealed) prisoner opened boxes with 4,9,7,10,8,3, then prisoner 5 opened 5, and they lost because the third prisoner opened 6 > 5 boxes.

Prove: No matter what strategy the prisoners follow, each permutation has the same probability (1/n!) of being the list recorded.

So the probability of the prisoners winning Game 2 (no matter what strategy they follow) is exactly the probability that a random permutation has no cycle of length greater than n/2.

Prove: Any strategy for Game 1 corresponds to a strategy for Game 2 with the same probability. (Trivial: the only change is that you don’t have to open boxes you’ve already seen opened.)

This proves that the pointer-chasing strategy is optimal for Game 1.

Here’s the puzzle as it was originally considered, still open: suppose there are n prisoners and 2n boxes, half of them empty. The prisoners can each examine n lockers. The pointer-chasing strategy doesn’t work as empty boxes point nowhere. Does the probability of winning go to 0 as n→∞?

There are no results on Google for “LeechBlock saved my life”, but there are testimonials like “Leech block has changed my life”, “Leechblock just saved my life”, and “This application is saving my thesis, and improving my social life”.

If LeechBlock isn’t working for you, you can try more extreme solutions like (on Mac) Freedom and SelfControl. (Found via this post.) But for me, right now, with my current level of work and self-awareness and other devices being employed, LeechBlock seems to be just about sufficient. (Although I do wish Safari were an even worse browser than it is.)

This reminds me of the trick I use for C/C++ of putting debugging statements inside a macro:

D(cerr<<"The number is "<<n<<endl;);

where the macro D is defined as

#define D(A) A

when you want the debugging code to run, and

#define D(A)

when you don’t. :-)

(The final semicolon after the D() is for Emacs to indent it reasonably.)

Update: Of course, the above are just hacky hacks to save typing. The “right” way for conditional C code is usually to use #ifdef DEBUG and the like, and the right way around the Firebug problem is to use something more general like this code at metamalcolm.