Kirkman's Schoolgirl Problem

Author

Eric W. Weisstein
November 23, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/KirkmansSchoolgirlProblem.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/KirkmansSchoolgirlProblem.html.

For a list of Eric's packages that may be needed to evaluate this notebook, see http://mathworld.wolfram.com/packages/.  An archive of these packages may be downloaded from http://mathworld.wolfram.com/packages/MathWorldPackages.zip, as well as from the Mathematica Information Center's MathSource item 4775.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Construction

Dörrie

Don't format these in TraditionalForm.  The FE typesetting is buggy and will ignore any editing you do, always evaluating to the *original* matrix.

k1={{{x,a1,a2},{x,b1,b2},{x,c1,c2},{x,d1,d2},{x,e1,e2},{x,f1,f2},{x,g1,g2}},{{b1,d1,f1},{a1,d2,e2},{a1,d1,e1},{a1,b2,c2},{a2,b1,c1},{a1,b2,c1},{a1,b1,c2}},{{b2,e1,g1},{a2,f2,g2},{a2,f1,g1},{a2,f2,g1},{a1,f1,g2},{a2,d2,e1},{a2,d1,e2}},{{c1,d2,g2},{c1,d1,g1},{b1,d2,f2},{b1,e1,g2},{b2,d1,f2},{b1,e2,g1},{b2,d2,f1}},{{c2,e2,f2},{c2,e1,f1},{b2,e2,g2},{c1,e2,f1},{c2,d2,g1},{c2,d1,g2},{c1,e1,f2}}};

k2={{{x,a1,a2},{x,b1,b2},{x,c1,c2},{x,d1,d2},{x,e1,e2},{x,f1,f2},{x,g1,g2}},{{b1,d1,f1},{a1,d2,e2},{a1,d1,e1},{a2,b2,c2},{a1,b1,c1},{a1,b2,c1},{a1,b1,c2}},{{b2,e1,g1},{a2,f2,g2},{a2,f1,g1},{a1,f2,g1},{a2,f1,g2},{a2,d2,e1},{a2,d1,e2}},{{c1,d2,g2},{c1,d1,g1},{b1,d2,f2},{b1,e1,g2},{b2,d1,f2},{b1,e2,g1},{b2,d2,f1}},{{c2,e2,f2},{c2,e1,f1},{b2,e2,g2},{c1,e2,f1},{c2,d2,g1},{c2,d1,g2},{c1,e1,f2}}};

UnsortedUnion[x_] := Module[{f},
    f[y_] := (f[y] = Sequence[]; y);
    f /@ x
  ]

chars=CharacterRange["A","O"];

Map[StringJoin,
k1/.Thread[UnsortedUnion[Flatten[k1]]->chars],
{2}]//MatrixForm

Wrong

Map[StringJoin,
kirkman=k2/.Thread[UnsortedUnion[Flatten[k2]]->CharacterRange["A","O"]],
{2}]//MatrixForm

Correct

kirkman

Transpose[kirkman]

Union[Sort/@Join@@@Transpose[kirkman]]

Each day's arrangement contains each girl once

Map[Transpose,Transpose[kirkman],{1}]