The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Algorithm about Counting Letters and Words in Text

Date: 01/03/2007 at 20:47:38
From: Ruben
Subject: Math involved in language texts - algorithms

Some years back in a magazine, Martin Gardner drew attention to a
phenomenon involving, as he later disclosed, an algorithm on the text
of language.  To illustrate the results that could be gotten, he 
reproduced the first paragraph of the Declaration of Independence, 
as follows:

  When in the Course of human Events, it becomes necessary for/ 
  one People to dissolve the Political Bands that have connected/
  them with another, and to assume among the Powers of the Earth/
  the separate and equal Station to which the Laws of Nature and of/ 
  Nature’s God entitle them, a decent Respect to the Opinions 
  of Mankind requires that they should declare the causes that
  impel them to the Separation.

Gardner then gave the following instructions:

1) Select a word from any of the first twenty words
2) Count the number of letters in that word; call that number n 
3) Starting with the NEXT word, move ahead n words in the text 
4) Upon reaching the nth word, count the number of letters in it 
5) Move ahead as many words as the new letter count 
6) Continue in this way, counting letters and moving ahead words using
   the latest letter count, until you end a count on a word beyond the
   4th line of the text 
7) What word is it?  (The word will be the same irrespective of which
   of the first twenty words you selected to start)

I have lost the magazine where I found this phenomenon described by 
Gardner.  In the Answers column, he mentioned that the procedure is 
based on an algorithm discovered by a certain mathematician; an 
associate regarding Math applied to texts.

I would like to know the names of the mathematicians, the name of the
algorithm, and if possible Gardner’s brief explanation, verbatim, of
how it works.  

The “text-puzzle” was presented in the May 1999 issue of "Games
Magazine", but although the answer (the first word on which the
counting stops, beyond the 4th line) is given, Gardner’s comments are

Date: 01/04/2007 at 13:33:25
From: Doctor Douglas
Subject: Re: Math involved in language texts - algorithms

Hi Ruben,

I also remember reading about this very interesting phenomenon.  A
web search (Google) using the search terms

  "Martin Gardner" text word count

gives some helpful web pages:

  Ross Eckler, Word Trees in Running Text 
  John Allen Paulos -  An Old Card Trick and New Biblical Hoax 

The name of the mathematician and physicist that is associated with
the origins of the idea is Martin Kruskal.  Here is a list of some
other resources that might be helpful in finding how Gardner described
the phenomenon of the "Kruskal count":

  C. Fulves and M. Gardner, The Kruskal Principle, The 
     Pallbearers Review, June 1975.

  M. Gardner, Mathematical Games, Sci. Amer. 238 (1978) No. 2 
     (February), 19-32.

  M. Gardner, From Penrose Tiles to Trapdoor Ciphers, W. H. Freeman
     Co., New York, 1988. (Chapter 19)

The basic idea is that these chains of linked elements running through
the entire sequence will, with high probability, intersect.  Once they
intersect, they will coincide forever thereafter.  For explanations by
others of how the phenomenon arises, try:

  Ivars Peterson, Science News for Kids:  Mathemusements 

  Ivars Peterson's MathTrek at MAA Online 

and for (much) more mathematical detail and rigor,

  J. C. Lagarias, E. Rains, and R. J. Vanderbei, "The Kruskal Count", 

- Doctor Douglas, The Math Forum 
Associated Topics:
High School Puzzles

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.