Here is an example in Haskell that will create groups of 14 non-repeating 11-pair combinations. The parameters of the “pair” are all combinations of pairs from 1 to 23 (for example, [1,2], [1,3], etc.). Then the program builds lists in which each list consists of 14 lists of 11 pairs (a choice of a pair of values), so that no pair is repeated and no number is repeated in one list of 11 pairs. You just need to place the missing last student every week, as you see fit. (It took about three minutes to calculate before it starts to output the results):
import Data.List import Control.Monad pairs = nubBy (\xy -> reverse x == y) $ filter (\x -> length (nub x) == length x) $ replicateM 2 [1..23] solve = solve' [] where solve' results = if length results == 14 then return results else solveOne [] where solveOne result = if length result == 11 then solve' (result:results) else do next <- pairs guard (notElem (head next) result' && notElem (last next) result' && notElem next results') solveOne (next:result) where result' = concat result results' = concat results
One sample output:
[[[12,17],[10,19],[9,18],[8,22],[7,21],[6,23],[5,11],[4,14],[3,13],[2,16],[1,15]], [[12,18],[11,19],[9,17],[8,21],[7,23],[6,22],[5,10],[4,15],[3,16],[2,13],[1,14]], [[12,19],[11,18],[10,17],[8,23],[7,22],[6,21],[5,9],[4,16],[3,15],[2,14],[1,13]], [[15,23],[14,22],[13,17],[8,18],[7,19],[6,20],[5,16],[4,9],[3,10],[2,11],[1,12]], [[16,23],[14,21],[13,18],[8,17],[7,20],[6,19],[5,15],[4,10],[3,9],[2,12],[1,11]], [[16,21],[15,22],[13,19],[8,20],[7,17],[6,18],[5,14],[4,11],[3,12],[2,9],[1,10]], [[16,22],[15,21],[14,20],[8,19],[7,18],[6,17],[5,13],[4,12],[3,11],[2,10],[1,9]], [[20,21],[19,22],[18,23],[12,13],[11,14],[10,15],[9,16],[4,5],[3,6],[2,7],[1,8]], [[20,22],[19,21],[17,23],[12,14],[11,13],[10,16],[9,15],[4,6],[3,5],[2,8],[1,7]], [[20,23],[18,21],[17,22],[12,15],[11,16],[10,13],[9,14],[4,7],[3,8],[2,5],[1,6]], [[19,23],[18,22],[17,21],[12,16],[11,15],[10,14],[9,13],[4,8],[3,7],[2,6],[1,5]], [[22,23],[18,19],[17,20],[14,15],[13,16],[10,11],[9,12],[6,7],[5,8],[2,3],[1,4]], [[21,23],[18,20],[17,19],[14,16],[13,15],[10,12],[9,11],[6,8],[5,7],[2,4],[1,3]], [[21,22],[19,20],[17,18],[15,16],[13,14],[11,12],[9,10],[7,8],[5,6],[3,4],[1,2]]]