Solution b8cc40b5-3191-4b5d-af1e-18544449bcbc

Points: 3 pts

Lemma 1: Doors scanned an odd number of times are unlocked at the end

Let $1$ represent locked and $-1$ represent unlocked. Since every scan switches the state, the state of a door after $n$ scans is
\[
S=(-1)^n.
\]
If $n$ is odd, then $n=2k+1$ for some integer $k$, so
\[
S=(-1)^{2k+1}=-1.
\]
Hence, a door scanned an odd number of times is unlocked at the end.

Lemma 2: $\#\operatorname{div}(i)$ is the number of times door $i$ is scanned

On pass $k$, door $i$ is scanned exactly when
\[
k\mid i.
\]
Thus, every pass that scans door $i$ corresponds to a positive divisor $k$ of $i$. Therefore, the number of times door $i$ is scanned is exactly
\[
\#\operatorname{div}(i).
\]

Lemma 3: Only square numbers have an odd number of divisors

Write the prime factorization of $M$ as
\[
M=p_0^{a_0}p_1^{a_1}\cdots p_r^{a_r}.
\]
Previously, we proved
\[
\#\operatorname{div}(M)=(a_0+1)(a_1+1)\cdots(a_r+1).
\]
Suppose $M$ is not a square. Then at least one exponent $a_i$ is odd, so
\[
a_i+1\equiv 0\pmod 2.
\]
Hence $\#\operatorname{div}(M)$ is even. By the contrapositive, if $\#\operatorname{div}(M)$ is odd, then $M$ is a square.

Final answer:
\{1,4,9,16,25,36,49,64,81,100\}