In the plane, consider the set $S$ of points with coordinates $(x, y)$, where $x, y \in$ $\{1,2, \ldots, 2013\}$. Two points in $S$ are called neighbors if they are at a distance of 1 from each other. Every second, a fly and some spiders move on the points of $S$ as follows: first, the fly either stays still or moves to a neighboring point of the one it is on. Then, each spider either stays still or moves to a neighboring point of the one it is on. Several spiders can be on the same point at the same time, and the fly as well as the spiders know each other's positions.
a) Determine the smallest integer $k$ for which $k$ spiders can always catch the fly in a finite time, regardless of the initial positions of the fly and the spiders on the points of $S$.
b) Answer the same question if we assume this time that we are in the usual space and that $S$ is the set of points with coordinates $(x, y, z)$ where $x, y, z \in\{1,2, \ldots, 2013\}$.
A single spider cannot catch the fly: indeed, the fly can wait until the spider is at a neighboring point to where it is located. From that moment on, it moves to a diagonally opposite point to the one the spider is on if the spider is at a neighboring point, and otherwise stays where it is.

We will now prove that, in the plane as in space, two spiders are sufficient to catch the fly.

For this, we denote $M$ as the fly, and we designate by $P$ and $Q$ the two spiders. For each animal $A$, we respectively denote $A_{x}, A_{y}$, and $A_{z}$ its abscissa, ordinate, and height.
a) The spiders $P$ and $Q$ first position themselves at the point with coordinates $(1,1)$. Since $M$ cannot indefinitely escape to the right, $P$ can then, in a finite time and by moving only horizontally, position itself at a point such that $P_{x}=M_{x}$ and $P_{y}=1$. Similarly, $Q$ positions itself at a point such that $Q_{x}=1$ and $Q_{y}=M_{y}$ (it is clear that if, for example, $P$ reaches this first goal before $Q$, it can follow the movements of $M$ by maintaining $P_{x}=M_{x}$ and $P_{y}=1$ and wait for the appropriate positioning of $Q$).

From these positions, reached at time $t_{0}$:

- if $M$ moves horizontally (i.e., such that $M_{x}$ changes), then $P$ does the same to maintain $P_{x}=M_{x}$.
- otherwise, $P$ moves vertically, towards $M$.

The spider $Q$ proceeds in the same way, but by swapping the roles of the abscissas and ordinates.
Using this strategy and from $t_{0}$, the quantity $\left|P_{y}-M_{y}\right|+\left|Q_{x}-M_{x}\right|$ never increases. However, this quantity remains constant only during a move of $M$ to the right or upwards, which can only happen a finite number of times. Consequently, after a finite time, at least one of the two terms of the sum will be equal to 0, indicating the loss of the fly.
b) The two spiders first position themselves at the point $(1,1,1)$. Then, by staying in the plane $\pi$ with the equation $z=1$ and by using the strategy from a), one of them will catch the shadow of $M$ in $\pi$ (i.e., the orthogonal projection of $M$ onto $\pi$). Without loss of generality, we can assume it is $P$, and we have $P_{x}=M_{x}$ and $P_{y}=M_{y}$. Once this is achieved, $P$ mimics its movements on those of $M$ to maintain these two equalities. However, if $M$ moves parallel to the height axis or remains stationary, then $P$ moves parallel to the height axis, but towards $M$ (and we note that $P_{z} \leqslant M_{z}$). Since $M_{z}$ cannot increase indefinitely, $M$ cannot escape from $P$ except by making a finite number of movements parallel to the height axis and by remaining stationary a finite number of times. Consequently, from a time $t_{1}$, the fly $M$ will no longer move in a single plane $\pi^{\prime}$ with the equation $z=$ constant, and without remaining stationary.

The spider $Q$ then positions itself in the plane $\pi^{\prime}$. By remaining stationary if necessary, it can make the quantity $f=\left|Q_{x}-M_{x}\right|+\left|Q_{y}-M_{y}\right|$ even. From this moment, noted $t_{2}$, $Q$ follows the following procedure:

- If $\left|Q_{x}-M_{x}\right|>\left|Q_{y}-M_{y}\right|$, then $Q$ moves parallel to the abscissa axis, so that $\left|Q_{x}-M_{x}\right|$ does not increase ($Q$ moves horizontally, along a line $d$, towards the projection of $M$ on the line $d$).
- Otherwise, $Q$ moves parallel to the ordinate axis, under similar conditions.

To fix ideas, we can assume that for all $t \in \mathbb{N}$, the fly moves at time $t+\frac{1}{3}$ and the spider at time $t+\frac{2}{3}$. Since neither $M$ nor $Q$ remains stationary, the movement of $M$ increases or decreases $f$ by one unit and the movement of $Q$ decreases $f$ by one unit, so for all $t \in \mathbb{N}$, $f(t)$ is even (in particular, $Q$ will never position itself on a neighboring point of $M$) and furthermore $f(t+1) \leqslant f(t)$.

Let $g=\max \left(\left|Q_{x}-M_{x}\right|,\left|Q_{y}-M_{y}\right|\right)$. We observe that the movement of $Q$ can only decrease $g$. Moreover,

- If the movement of $M$ at time $t+\frac{1}{3}$ decreases $g$, then $g(t+1) \leqslant g(t)$.
- Suppose that the movement of $M$ at time $t+\frac{1}{3}$ increases $g$. If, for example, $M$ has moved in the direction of the $x$-axis, necessarily $\left|Q_{x}(t)-M_{x}(t)\right| \geqslant\left|Q_{y}(t)-M_{y}(t)\right|$ and $M$ has moved away from $Q$, so after the movement of $M$ we have $\left|Q_{x}-M_{x}\right|>\left|Q_{y}-M_{y}\right|$. Consequently, the spider moves in the same direction as the fly, and we have $g(t+1)=g(t)$.
In all cases, we see that $g(t+1) \leqslant g(t)$ for all $t \in \mathbb{N}$, so there exists $t_{2} \in \mathbb{N}$ such that $g(t)=g\left(t_{2}\right)$ and $f(t)=f\left(t_{2}\right)$ for all $t \geqslant t_{2}$. Suppose by contradiction that $g\left(t_{2}\right)>0$.

By changing the orientation of the axes if necessary, we can assume that $Q_{x}\left(t_{2}\right) \leqslant M_{x}\left(t_{2}\right)$ and $Q_{y}\left(t_{2}\right) \leqslant M_{y}\left(t_{2}\right)$. - First case: $Q_{y}\left(t_{2}\right)=M_{y}\left(t_{2}\right)$. Since $f\left(t_{2}\right)$ is even, we have $M_{x}\left(t_{2}\right) \geqslant Q_{x}\left(t_{2}\right)+2$. If between times $t_{2}$ and $t_{2}+1$ the fly moves in the direction of the $y$-axis, then the spider moves to the right, and $g\left(t_{2}+1\right)=g\left(t_{2}\right)-1$. Impossible. If the fly moves to the left, then its movement decreases $f$ by one unit, so $f\left(t_{2}+1\right)=f\left(t_{2}\right)-2$. Impossible. We deduce that the fly moves to the right, and consequently the spider as well. By immediate induction, we get that $M_{x}\left(t_{2}+k\right)=M_{x}\left(t_{2}\right)+k$ for all $k \in \mathbb{N}$, which is impossible.

- Second case: $Q_{x}\left(t_{2}\right)=M_{x}\left(t_{2}\right)$. Analogous.
- Third case: $Q_{x}\left(t_{2}\right)<M_{x}\left(t_{2}\right)$ and $Q_{y}\left(t_{2}\right)<M_{y}\left(t_{2}\right)$. Since the movement of $Q$ strictly decreases the quantity $f$, the movement of $M$ must increase $f$ by one unit. Consequently, between times $t_{2}$ and $t_{2}+1$, the fly must move to the right or upwards. We easily deduce that $Q_{x}\left(t_{2}+1\right)<M_{x}\left(t_{2}+1\right)$ and $Q_{y}\left(t_{2}+1\right)<M_{y}\left(t_{2}+1\right)$. By immediate induction, the sequence $\left(M_{x}\left(t_{2}+k\right)+M_{y}\left(t_{2}+k\right)\right)_{k \in \mathbb{N}}$ is strictly increasing, which is impossible since it is bounded and takes integer values.
In all cases, we have reached a contradiction, which proves that $g\left(t_{2}\right)=0$ and that the spider has caught the fly at time $t_{2}$.