I have been pondering something puzzling about text processors, along the lines of TexTheProgram. It is tough to assign forward page number references until you have processed the whole book. But, what if the page number on say page 50 causes the page to "bump up" to the next page, changing the very reference that it bumped? For example page 50 could say "see page 99 for more details". But, putting "99" there bumps up the page count such that now the target is page 100 instead of 99? It may not be common enough to worry about in practice, but I see the potential for an infinitely loop. I suppose the text processor could assume large page number references, and then pad line or paragraph spacing to make up for the overestimates.
A: WhiteOut ;-)
The loop isn't infinite. It's worst-case runtime is log(n) where n is the number of page references; however in practice the runtime doesn't exceed 2.
See also: ResearchIdeas?