Douwe Osinga's Blog: August 2006

Monday, August 28, 2006

Typing monkeys

A long time ago a good friend of mine told me this puzzle. Let’s say there is a monkey hitting a typewriter at random. And let’s assume he is only hitting letters and that the chance for each letter to get hit is equal. Do you have to wait on average longer, the same or shorter before the monkey will have typed ‘abracadabra’ or ‘abcdefghijk’ (i.e. a string with an equal amount of characters)? Don’t start reading the next paragraph if you want to solve the puzzle, since I am going to give away the answer.


Most people tend to say, well, it must be ‘abracadabra’ that on average shows up first. Abracadabra’s can overlap, so it is just more likely that you have that sequence and therefore you have to wait less long on average before it appears. Sounds reasonable enough, but is of course wrong.


A smaller group of people tends to say that it must be equally long. If you randomly select a character in the stream of characters coming from the monkey and ask yourself, how likely is it that at this point ‘abracadabra’ or ‘abcdefghijk’ starts, you’ll see that these chances must be equal, that is, once the monkey starts typing the first letter of the sequence, he has to type exactly one letter as the next and the chance of him doing that is 1 in 26 and this is independent on what he needs to type. Again, sounds reasonable but is also wrong (or more to the point, this is correct, but that was not the question).


That pretty much leaves only the third option, i.e. abracadabra takes longer. I have two explanations here. The first one combines the previous two answers. Yes, abracadabra’s can overlap and yes the chance for abracadabra to start at a certain point, is the same as for a-k.  So if we have a lengthy string of characters typed by our monkey, we expect that the number of occurrences for abracadabra to be the same as for a-k. But since abracadabra’s can overlap, they take up less space so to say (i.e. a larger portion of this string is made up of characters that are not part of abracadabra then not part of a-k). Therefore the average distance between groups of characters that are part of abracadabra must be larger than the average distance between groups of characters being part of a-k. Since when we are starting to type we are not in the middle of a group of abracadabra characters, it will take longer before we encounter some group first.


Not everybody is convinced by this explanation. Another way of looking at it, is to look what happens when the monkey types and only needs the last character of any of the targets. In the case where he is trying to type abracadabra, there are two options, either he types the a, or he doesn’t. If he doesn’t, the monkey will have start all over again. In the case of a-k, the monkey as three options: he types a ‘k’ and we’re done, he types b-j and we have to start over, or he types an ‘a’ and the monkey has blown this chance of typing a-k, but we already have the first letter of the next try, something that doesn’t work with abracadabra.


If you’re not convinced still, I wrote a python program to simulate this. I am not using abracadabra, but ab vs aa. And my monkey doesn’t type all letters, but only a,b,c,d,e and f. Still, this shouldn’t make a difference. Except for one thing: on average you have to wait 34 characters before you see ‘ab’ and around 40 before you see ‘aa’ . However, if you let the monkey type and you count how often ‘ab’ occurs before ‘aa’, you’ll see that this is equal. Confused? Well, the first chance of either ‘ab’ or ‘aa’ is just after the first ‘a’; if the monkey types an ‘a’ or a ‘b’ we’re done. However, if the monkey types an ‘a’, ‘aa’ wins, but ‘ab’ has good chance of being just one after. If ‘ab’ wins, ‘aa’ has no such chance.

Thursday, August 24, 2006

Astrology and Pluto

Astronomers just voted and alas, Pluto no longer has the status of a planet. A sad day for the Pluto fans, but as we find more and more Pluto like objects out there it becomes clear that you have to draw the line between planet and non planet somewhere and Pluto just doesn't have what it takes. Too bad for het Goede Doel.


I always wondered how astrologers felt about the outer planets. They do occur in their analysis, but since they are recent discoveries, astrologers from before those discoveries can't have used them. I've always assumed that it is just added forces; before the discovery of Uranius, Neptune and Pluto astrology's predictions must have been just a little less accurate, like predicting the weather with just few satelite instead of complete coverage.


This of course begs the question what they are going to do now. Are they going to also demote Pluto and say, well, all those predictions based on Pluto's position were wrong or we were misguided? Or will they stick to their guns and disagree with the astronomers' analysis and keep Pluto in there. And in that case, will they also recognize the cosmic influences of the other dwarf planets, Ceres, Charon and, well, UB313?


Your love life this month: with UB313 in Scorpio, there is not much you can expect.

Thursday, August 17, 2006

Zurich, Sweden

In the US it seems quite common to confuse Switzerland with Sweden. Visitors to the Zurich office kept remarking how that town was the prettiest town of all of Sweden and their host kept complimenting them on their good eye sight if they could see that from there.


But it is not just the Americans. It took me about a year to tell my bank I no longer lived in the Netherlands, but after I finally mailed them my change of address notice, I saw that they were now sending mail to the correct street address, but that they had specified Sweden as a country. The amazing thing is that the post delivered the mail just fine; they probably just go, oh another Zurich, Sweden. Just put it on the stack.


I wanted to ignore the thing, but my wife sent them an email pointing out their error. The bank told her that I should tell them since it was my account. I duly complied. I got a friendly reply pointing out where on the website I could download an address change form. I replied that I didn't want to change my address, I wanted the bank to fix their mistake. But the bank pointed out that they couldn't trust email. The fact that there is no Zurich in Sweden and that almost always if you send mail to Zurich in Sweden the post will deliver it in Zurich was something they didn't deny and they could see the ridiculousness of the situation. Now if I could only download, fill in, sign and send off the form. Needless to say my mail is still being sent to Sweden.

Saturday, August 5, 2006

The rich getting richer

Bill Gates has been the richest man in the world since for forever of course, but the last years it sometimes seemed like he could lose that position. No, not to the boys wonder who founded Google, they are doing quite ok, but are not even close.
I was thinking of Warren Buffet, the sage of Omaha, who made his money by clever investing. If you beat the market consistently by a large margin for sixty years or so even a small starting capital grows quite large. Buffet famously refused to invest in the Internet stocks around 2000, saying he didn't see how they would make money and the bulls were saying that he just gotten too old until it turned out he just still was smart.


Anyway Warren Buffet will no longer be a threat to Bills pole position. Warren gave away most of his money, in total around 37 billion. To whom? To Bill Gates. So it seems true what they say about the rich getting richer (or at least one of them)
Of course this is not quite true. The money wasn't donated to Bill the person, but to Bill the foundation or the Bill and Melissa Gates Foundation, already the largets foundation of its kind, but with Bill Gates quitting Microsoft it is almost the same. And it is a good thing too. Geeks have learned to mistrust the dark lord of Redmond or at least his business ways, but as far as charity goes I think he has made all the right calls.


If I needed somebody to help dispose of 37 billion dollars, I think I'd approach Bill too. He is pretty much the only person with experience in the field.