# Thread: can 17 teams play 14 games each ?

1. ## can 17 teams play 14 games each ?

My neighbor runs a basketball league and asked me (a computer programmer) to generate a list of match ups for him. I readily accepted, but it's turning out harder than I thought.

Is it really possible to have 17 teams each play 14 games such that they don't play each other twice?

I am beginning to suspect that it's not possible - for instance, I've proven by trial and error that you can't get 5 teams to play 3 games.

Is there a general formula I can use to determine whether a given number of teams can play a given number of games w/o playing each other twice?

2. How about brute force to help us in this problem?

Pick one team from 17 teams, and then decide arbitrarilty their 14 oppnenets, let's mark the teams as 1-17.
then: 1 will face 2-15.
2 will face 1 and 3-15.
3 will face 1 and 2 and 4-15.
4 will face 1 and 2 and 3 and 5-15.
5 will face 1,2,3,4 and 6-15.
6 will face 1,2,3,4,5 and 7-15
7 will face 1,2,3,4,5,6 and 8-15.
8 will face 1,2,3,4,5,6,7 and 9-15.
9 will face 1-8 and 10-15.
10 will face 1-9 and 11-15
11 will face 1-10 and 12-15
12 will face 1-11 and 13-15
13 will face 1-12 and 14-15
14 will face 1-13 and 15.
15 will face 1-14.
Now for 16 and 17 you have the freedom to choose which they should play against, because we have 15 teams to choose from.

I might have some errors as I haven't checked it thoroughly.