A book titled The Bible Code introduced the topic of equidistant letter sequences (ELS), described below, for finding words “hidden” in text. That book referenced the Hebrew Bible, but prompts a question about finding any given word in any, say, English-language text.
For simplicity, and to better match the Hebrew, spaces and punctuation are removed. A particular text that I have in mind, thus crunched, has 284,939 characters remaining (letters and digits). How many times would you expect to find the word FLOOBLE as an equidistant letter sequence in the text? Ignore case. The word can start at any of the 284,939 characters and proceed by skipping any constant number of letters forward or backward. So, for example, if the 11,000th character were an F and the 10,000th an L, and the 9,000th an O, etc. that would be one occurrence. Of course we don’t expect always to find such decimally round spacings. The question again, How many do we expect to find?
The absolute and relative frequencies of the relevant letters in the text are:
B 4771 0.016744
E 36232 0.127157
F 7167 0.025153
L 9563 0.033562
O 22486 0.078915
that is, for each letter is shown the number of occurrences in the text and that number divided by the total of characters in the text.
the chance, beginning at an arbitrary location, and skipping a given number of digits each time yields a probibility of (given that the skipping doesn't cause you to run out of room) the product of the probibilities of each letter. Based on the large number of letters, it is safe to assume the data is independant. This number works out to 3.7567 * 10^-10, or so, whjich is pretty small.
Next we need to find the total number of arbitrary starting points and skip digits that will not exceed the bounds of the text. Counting forwards only (the number reached can be doubled to include revers skips), there is a pattern which needs to be summed. Letters 1-5 have 47489 different possible skip digits, letters 6-11 have one less, 12-17 have still one less etc. This pattern will give the total number of possible orientations.
Once this calculation is complete, the two numbers, multiplied by each other will give the expected number of occurences.