Why log₂ of the player count
In a Swiss tournament everyone plays every round, and players are paired with others on the same score. The FIDE rules put it simply: participants are paired to others with the same score, nobody meets the same opponent twice, and the number of rounds is declared before the start.
So the players who have won every game play each other. Each round halves that group, rounded up when it's odd, because the odd one out plays someone lower and can win as well. Start with 16 and the perfect scores go 8, 4, 2, 1. Start with 20 and they go 10, 5, 3, 2, 1: five rounds, because 20 is more than 16. That's where ⌈log₂ n⌉ comes from.
| Players | Rounds | Unbeaten after round 1, 2, 3 … |
|---|---|---|
| 4 | 2 | 2, 1 |
| 5 to 8 | 3 | 4, 2, 1 |
| 9 to 16 | 4 | 8, 4, 2, 1 |
| 17 to 32 | 5 | 16, 8, 4, 2, 1 |
| 33 to 64 | 6 | 32, 16, 8, 4, 2, 1 |
| 65 to 128 | 7 | 64, 32, 16, 8, 4, 2, 1 |
| 129 to 256 | 8 | 128, 64, 32, 16, 8, 4, 2, 1 |
| 257 to 512 | 9 | 256, 128, 64, 32, 16, 8, 4, 2, 1 |
When to play more rounds
The minimum finds one winner. It doesn't rank second and third reliably, and draws (in chess, say) leave more players level at the top. If places below first matter, for prizes or a cut to a playoff, add a round. Every extra round costs the length of a round, so check it against your venue time.
Card game organizers have a published table for this. The Magic: The Gathering Tournament Rules, Appendix E, required for Wizards' Premier events and optional for others, sets the rounds by player count, with a playoff for the top players afterwards:
| Players | Swiss rounds | Then |
|---|---|---|
| 5 to 8 | None | Run single elimination (3 rounds) |
| 9 to 16 | 5 | Top 4 (booster draft: 4 rounds, then Top 8) |
| 17 to 32 | 5 | Top 8 |
| 33 to 64 | 6 | Top 8 |
| 65 to 128 | 7 | Top 8 |
| 129 to 226 | 8 | Top 8 |
| 227 to 409 | 9 | Top 8 |
| 410+ | 10 | Top 8 |
Most of its rows match ⌈log₂ n⌉. It plays one more round for 9 to 16 players (outside booster draft), for 227 to 256 and for 410 to 512, it runs a straight knockout below 9, and it stops at 10 rounds however many come.
Byes and odd numbers
With an odd number of players, one sits out each round. Under the FIDE basic rules that player gets as many points as a win unless the tournament's own rules say otherwise, and nobody gets a second pairing bye. Count a bye in your timing: the player who sits out still waits for the round to end.
Running it on Programmable Talk
If you're running the event, Talk's tournament template does the pairing for you. Players register for the event, and you can open check-in before the start. Talk plans ⌈log₂ n⌉ rounds by default and you can set your own number. It pairs each round on score without rematches, gives the bye to the lowest-placed player who hasn't had one, and ranks by points, then head-to-head, then score difference, then Buchholz (the sum of opponents' points). Players can report their own results, and the standings update on the event's site as each result comes in.