There is a theorem of Whitehead that lens spaces $L(p,q)$ and $L(p,q')$ are of the same homotopy type iff $\pm qq'≡ m^2 (\mathrm{mod}\ p)$ for some $m$. As a consequence, for a given $p$, there is only one homotopy type of $L(p,q)$ if $p=4k+3$ is prime, and two if $p=4k+1$ is prime (see Rolfsen's book *"Knots and Links"*). What if $p$ is not prime? Is it true that there are also two homotopy types? If not, is there any counterexample?



How many homotopy types of lens spaces L(p,q) if the given integer p is not prime?
No; in fact, there can be arbitrarily many homotopy types.


The theorem you quote says that the number of homotopy types, for a given $p$, is the same as the size of the following quotient group: $(\Bbb Z/p\Bbb Z)^\times$, the group of units in the ring $\Bbb Z/p\Bbb Z$, modded out by the subgroup generated by its squares and $-1$. By the Chinese remainder theorem, we can calculate this size on the prime-power factors of $p$ and multiply all the answers together.


Moreover, it's easy (given known elementary number theory statements related to primitive roots, which are already used in the prime-$p$ result you mention), to show that if $p=\ell^r$ is a power of the prime $\ell$ ($r\ge1$), then the size of this quotient is $1$ if $\ell\equiv3\pmod4$, is $2$ if $\ell\equiv1\pmod4$, is $1$ if $\ell=2$ and $1\le r\le2$, and is $2$ if $\ell=2$ and $r\ge3$.


Consequently, define $f(p) = \#\{\ell\mid p\colon \ell \text{ is prime, } \ell\equiv1\pmod 4\}$, and define $g(p) = f(p)+1$ if $8\mid p$ and $g(p) = f(p)$ if $8\nmid p$. (Here $a\mid b$ means "$a$ divides $b$".) Then the number of homotopy types for a given $p$ is exactly $2^{g(p)}$.


The smallest $p$ for which there are more than $2$ homotopy types is $p=40$; there are $4$ homotopy types, with the corresponding equivalence classes of $q$ represented by:
\begin{align\*}
&\{1,9,31,39\}\\
&\{11,19,21,29\}\\
&\{3,13,27,37\}\\
&\{7,17,23,33\}
\end{align\*}
The smallest $p$ for which there are more than $1{,}000$ homotopy types is $p=8\cdot5\cdot13\cdot17\cdot29\cdot37\cdot41\cdot53\cdot61\cdot73 = 91{,}783{,}456{,}403{,}080$.


