[Combinatorics]
Problem: Elizabeth is in an "escape room" puzzle. She is in a room with one door which is locked at the start of the puzzle. The room contains $n$ light switches, each of which is initially off. Each minute, she must flip exactly $k$ different light switches (to "flip" a switch means to turn it on if it is currently off, and off if it is currently on). At the end of each minute, if all of the switches are on, then the door unlocks and Elizabeth escapes from the room.

Let $E(n, k)$ be the minimum number of minutes required for Elizabeth to escape, for positive integers $n, k$ with $k \leq n$. For example, $E(2,1)=2$ because Elizabeth cannot escape in one minute (there are two switches and one must be flipped every minute) but she can escape in two minutes (by flipping Switch 1 in the first minute and Switch 2 in the second minute). Define $E(n, k)=\infty$ if the puzzle is impossible to solve (that is, if it is impossible to have all switches on at the end of any minute).

For convenience, assume the $n$ light switches are numbered 1 through $n$.
Find the $E(2001,501)$

Solution: $E(2001,501)=5$. First, note that three minutes is not enough time to flip each switch once. In four minutes, Elizabeth can flip each switch once, but has three flips left over. Because there are an odd number of leftover flips to distribute among the 2001 switches, some switch must get an odd number of leftover flips, and thus an even number of total flips. Thus $E(2001,501)>4$.

To solve the puzzle in five minutes, Elizabeth can flip the following sets of switches:

- in the first minute, $\{1,2,3, \ldots, 501\}$;
- in the second minute, $\{1,2,3, \ldots, 102\}$ and $\{502,503,504, \ldots, 900\}$;
- in the third minute, $\{1,2,3, \ldots, 102\}$ and $\{901,902,903, \ldots, 1299\}$;
- in the fourth minute, $\{1,2,3, \ldots, 100\}$ and $\{1300,1301,1302, \ldots, 1700\}$;
- in the fifth minute, $\{1,2,3, \ldots, 100\}$ and $\{1701,1702,1703, \ldots, 2001\}$.

This results in switches $1,2,3, \ldots, 100$ being flipped five times, switches 101 and 102 being flipped three times, and the remaining switches being flipped exactly once, so that all the lights are on at the end of the fifth minute.

Final answer: 5