See this paper for a more detailed explanation of this problem, and it's relation to other combinatorial problems.
Maintained by Russell Martin. Original programming by Andrew O'Hagan. Last updated: 22 November 2017.