Wednesday, May 29, 2013

Logical Fun With Lyrics: Sublime and the Toyes' Recursive Joint Smoking Algorithm


In 1992 the ska punk band Sublime released their version of a classic reggae song from 1983: "Smoke Two Joints" by the Toyes (NOT by Bob Marley, as Google suggested search would lead me to believe. Come on people, not every reggae song is by Bob Marley.) Here's the original, along with some truly, um, interesting fan made illustrations:

And here's Sublime's more well known cover:

Listening to the awesome lyrics, you get the impression that the narrator of the song likes to smoke joints. In particular he likes to smoke joints two at a time. He smokes "two joints in the morning", "two joints in the evening", two joints in "time of peace" and "two in time of war." But most interestingly the narrator makes the following claim: "I smoke two joints before I smoke two joints, and then I smoke two more", which begs the question: how many joints does he smoke in total during this particular smoking session? Using the rules of logic I have found the answer, and I warn, the answer may shock you!

Let's think about this. If he "smokes two joints before he smokes two joints" and then smokes "two more", how many joints is this in total? two? four? six? When I first heard this song as a kid, I thought six joints, because he would smoke two joints before smoking two more joints, and then smoke two more after that for a total of six. But this can't be the case. Looking at the statement carefully, when he talks about the "two more" joints, he could only be referring to that second set of joints he already mentioned. Think of it this way, these are the things he does in order:
1. Smoke two joints before he smokes two joints.
2. Smoke the two more joints already mentioned in the statement above.
This gives us a total of four joints. This is perhaps a better reasoned answer than my first guess of six. But I shall now show that it is not the case either! The number of joints he smokes during this session is not six, it's not four. It is zero. He will smoke no joints. None.

I know this doesn't seem to make sense, but hear me out. If we accept as true the narrator's claim that he "smokes two joints before he smokes two joints," he will never smoke a single joint. Why? Because, in order to actually smoke two joints, he must first smoke two entirely different joints, and before smoking those two joints, he must first smoke two other joints, and before that two other joints, and  so on and so on to infinity! So what will happen? The narrator will keep preparing (but not smoking) joint after joint after joint in an endless loop, and never once take a puff! He'll tell himself, "OK I've got two joints to smoke, gotta get two more to smoke before I smoke those... and gotta get two more before I smoke those...  and gotta get two more before I smoke those..." and never smoke. For those who understand a little bit about algorithms, this is an endless recursive algorithm. In pseudo-code we could describe it as follows:

Procedure: smokeTwoJoints{
step 1: Do the procedure smokeTwoJoints;
step 2: smoke one joint;
step 3: smoke another joint;
end;
}

If you understand the algorithm you can see that this procedure will endlessly call itself. Step one will happen an infinite number of times, and the smoker will never get to the last two steps.

So ironically, when these lyrics are taken literally and broken down to their logical elements, in an attempt to smoke an infinite number of joints, this ultimate pot-smoker will not smoke any joints at all!! So let this be a warning to people out there. Never make it a rule that you smoke two joints before you smoke two joints, otherwise you will get stuck in an endless recursive loop. For that matter, don't make it a rule that you shampoo your hair before you shampoo your hair, or eat two pancakes before you eat two pancakes, or anything else.

No comments:

Post a Comment