I translated your tex-file to pdf by using pdflatex. I obtained a pdf-document of 6046 pages. This is the correct number of boards that contain an equal number of Os and Xes, plus the number of boards that contain one more X than Os ( because it is X that starts the game ). You may easily obtain the number 6046 by adding up products of the appropriate binomial coefficients. However, some of the hyperlinks are superfluous, because they would never be used in a real game. For example, page 3113 of the pdf shows a board with 3 Xes and 2 Os, like this : X X X \ - O - \ O - - ; a situation where X has won the game. Then this particular page should not contain any hyperlinks, because the game may be considered over. But page 3113 of the produced pdf-file still has 7 hyperlinks, as can easily be seen by clicking on each of the 9 boxes : 7 of the 9 possible clicks will send you to a different page. Hence, my conclusion is, that by improving the used algorithm, you may be able to reduce the number of hyperlinks and hence the size of the pdf-file. How to improve the algorithm would be a problem for further study.