Maynard Smiths maximum chi(2) method is a useful tool for detecting recombination. Significance testing is usually carried out by random permutation, which may require a large amount of computer time. I describe an exact algorithm.