I need to calculate a sequence of numbers (similar to Sudoku) to match teams to play each other.
I need to create a matrix for 8 and 9 teams and can't figure out the formula. I have to believe this is really simple, but I have no idea what to search for to find it.
Here is a working version for 7 teams:
team |1 2 3 4 5 6 7
====================
week 1 | 7 6 5 4 3 2
week 2 | 7 5 6 3 4 1
week 3 | 6 5 7 2 1 4
week 4 | 5 6 7 1 2 3
week 5 | 4 3 2 1 7 6
week 6 | 3 4 1 2 7 5
week 7 | 2 1 4 3 6 5
So for the first week, team 1 doesn't play (no available partner), team 2 plays team 7, team 3 plays team 6, etc. For week 2, team 1 plays team 7, etc.
No team may play the other team. The event continues for as many weeks as we have teams, so 8 teams would play for 8 weeks.
Each team should play another team once and only once. They can't play themselves (hence the blank entry in each row.
Note that the upper right triangle is a mirror of the bottom left triangle, but that still didn't help me determine the formula.
My guess is that if I spent enough hours, I could figure out the formula. But since this has to have been done a few million times by people over the ages, I am guessing that it's a well known algorithm and I just need to find someone who knows the name (so I can look it up) or can tell me what it is so I can create this for a friend who needs it.
Thanks!