Source: TSTST-2020-P9
Category: Graph Theory

Problem:
Ten million fireflies are glowing in $\RR^3$ at midnight. Some of the fireflies are friends, and friendship is always mutual. Every second, one firefly moves to a new position so that its distance from each one of its friends is the same as it was before moving. This is the only way that the fireflies ever change their positions. No two fireflies may ever occupy the same point. Initially, no two fireflies, friends or not, are more than a meter away. Following some finite number of seconds, all fireflies find themselves at least ten million meters away from their original positions. Given this information, find the greatest possible number of friendships between the fireflies.

Solution:
In general, we show that when $n \ge 70$, the maximum number of friendships is $f(n) = \left\lfloor \frac{n^{2}}{3}\right\rfloor$. 

**Construction:** 
Choose three pairwise parallel lines $\ell_{A}$, $\ell_{B}$, $\ell_{C}$ forming an infinite equilateral triangular prism (with side length larger than $1$). Split the $n$ fireflies among the lines as equally as possible, and say that two fireflies are friends if and only if they lie on different lines. To see that this configuration works, we can move the fireflies as follows: 
- Reflect $\ell_{A}$ and all fireflies on $\ell_{A}$ across the plane containing $\ell_{B}$ and $\ell_{C}$. 
- Reflect $\ell_{B}$ and all fireflies on $\ell_{B}$ across the plane containing $\ell_{C}$ and $\ell_{A}$. 
- Reflect $\ell_{C}$ and all fireflies on $\ell_{C}$ across the plane containing $\ell_{A}$ and $\ell_{B}$.
By repeating these reflections, all fireflies can move arbitrarily far without changing the distances to their friends.

**Proof:** 
Consider a valid configuration of fireflies. If there is no $4$-clique of friends, then by Turán's theorem, there are at most $f(n)$ pairs of friends. 

Let $g(n)$ be the maximum number of friendships given that there exist four pairwise friends (say $a$, $b$, $c$, $d$). Note that for a firefly to move, all its friends must be coplanar. We cannot have four coplanar fireflies which are pairwise friends; if we did, none of them could move (unless three are collinear, in which case they also cannot move). We claim there are at most $12$ fireflies $e$ which are friends with at least three of $a$, $b$, $c$, $d$.

First, denote by $A$, $B$, $C$, $D$ the locations of fireflies $a$, $b$, $c$, $d$. These four positions change over time as fireflies move, but the tetrahedron $ABCD$ always has a fixed shape, and we will take this tetrahedron as our reference frame for the remainder of the proof. Without loss of generality, assume that $e$ is friends with $a$, $b$, $c$. Then $e$ will always be located at one of two points $E_{1}$ and $E_{2}$ relative to $ABC$, such that $E_{1}ABC$ and $E_{2}ABC$ are two congruent tetrahedrons with fixed shape. We note that points $D$, $E_{1}$, and $E_{2}$ are all different: clearly $D \neq E_{1}$ and $E_{1} \neq E_{2}$.

Consider the moment when firefly $a$ moves. Its friends must be coplanar at that time, so one of $E_{1}, E_{2}$ must lie in the plane $BCD$. Similar reasoning holds for the planes $ACD$ and $ABD$ when $b$ and $c$ move. So, without loss of generality, $E_{1}$ lies on both planes $BCD$ and $ACD$. Then $E_{1}$ lies on the line $CD$, and $E_{2}$ lies in the plane $ABD$. This uniquely determines the pair $(E_{1},E_{2})$ relative to $ABCD$: $E_{1}$ is the intersection of the line $CD$ with the reflection of the plane $ABD$ across the plane $ABC$, and $E_{2}$ is the intersection of the plane $ABD$ with the reflection of the line $CD$ across the plane $ABC$.

Accounting for the symmetric choices, there are at most $12$ possibilities for the set $\{E_{1},E_{2}\}$, and thus at most $12$ possibilities for $E$. Therefore, the number of friendships with exactly one endpoint in $\{a, b, c, d\}$ is at most $(n-16)\cdot 2 + 12\cdot 3 = 2n + 4$. Removing these four fireflies gives the recurrence
\[
g(n) \le 6 + (2n+4) + \max\{f(n-4),\, g(n-4)\}.
\]

When $n \ge 24$, we have $(2n+10) + f(n-4) \le f(n)$, so
\[
g(n) \le \max\{f(n),\, (2n+10) + g(n-4)\}
\]
for all $n \ge 24$. By iterating the above inequality, we obtain
\[
g(n) \le \max\Big\{f(n),\; (2n+10) + (2(n-4)+10) + \dots + (2(n-4r)+10) + g(n-4r-4)\Big\},
\]
where $r$ satisfies $n-4r-4 < 24 \le n-4r$. Evaluating the sum yields
\begin{align*}
(2n+10) + (2(n-4)+10) + \dots + (2(n-4r)+10) + g(n-4r-4)
&= (r+1)(2n-4r+10) + g(n-4r-4) \\
&\le \Big(\frac{n}{4} - 5\Big)(n+37) + \binom{24}{2}.
\end{align*}

This quadratic bound is strictly less than $f(n) = \left\lfloor \frac{n^{2}}{3}\right\rfloor$ for $n \ge 70$. Since the initial number of fireflies is $n = 10^7 \ge 70$, the maximum possible number of friendships is exactly $f(10^7) = \left\lfloor \frac{10^{14}}{3}\right\rfloor$, which concludes the solution.

Answer: \(f(n) = \lfloor \frac{n^2}{3} \rfloor\)

Grading guidelines:
(Partial) 1. Gave the extremal-graph bound for the no-$K_4$ case, i.e. correctly applied Turán’s theorem to deduce that if the friendship graph contains no $4$-clique then the number of friendships is at most \(\lfloor n^2/3\rfloor\). 2. Provided a correct construction achieving \(\lfloor n^2/3\rfloor\) friendships (e.g. partition into three parts and make all cross-edges), together with a geometrically valid motion rule showing the configuration can move arbitrarily far while keeping all friend-distances fixed. 3. Established the key geometric constraint: when a firefly moves while preserving distances to all its friends, all of its friends must lie in a plane (equivalently, the moving point lies on the intersection of spheres, hence is confined to at most a circle/finite set unless the centers are coplanar). (Almost) 1. Proved the upper bound \(\le \lfloor n^2/3\rfloor\) by splitting into the no-$K_4$ case (Turán) and the $K_4$ case via the “few neighbors of a $K_4$”/recurrence argument, but left a localized gap in the $K_4$ case (e.g. did not fully justify the bound on the number of vertices adjacent to 3 of the 4 clique vertices, or the inequality iteration for large $n$). 2. Gave a correct construction with \(\lfloor n^2/3\rfloor\) friendships and a near-complete verification of the motion to distance \(\ge n\), but omitted checking one necessary condition (e.g. why no collisions occur during the repeated reflections, or why all pairwise initial distances can be kept \(\le 1\) after placing points on the three lines). 3. Solution is almost complete, but made minor mistakes which are not negligible.