Goodmorning, I would like to prove the following lemma: let $p>1$ be an odd integer, then $$\#\{n\leq2p : n \text{ odd}, \quad p\mid n(n+2)\}=2^{\nu(p)}$$ where $\nu(p)$ is the number of different prime factor of $p$. I only need an idea of solution, no formalism is required.
Note that if $p=p_1^{e_1}\cdots p_k^{e_k}$, we can assume $e_i=1$ for all $i$, in fact each $p_i$ cannot divide both $n,n+2$. Then, let's assume $p=p_1\cdots p_k$.
If $k=1$ it's obvious. So only need to prove it for $p=p_1p_2$, the result will follow by induction.
I finally managed to solve it.
If $n$ odd is such that $0\leq n \leq 2p$, then $n=2t+1$ for $t\in\{0,...,p-1\}$.
So we can think at this problem as counting the roots of a polynomial:
$$\#\{n\leq 2p : n \text{ odd}, p\mid n(n+2)\}=\#\{x\in \mathbb{Z}_p : f(x):=(2x+1)(2x+3)\equiv 0 \pmod{p}\}$$
Now we write $p = p_1^{e_1}\cdots p_k^{e_k}$. The number of solutions modulo $p_i$ are obviously $2$: $$x_1=\frac{p-1}{2} \qquad x_2=\frac{p-3}{2}$$ Note that they are distinct. Now $$f'(x)=8x+8\equiv 0 \pmod{p} \Longleftrightarrow x\equiv -1 \pmod{p}$$ Note that $-1 \pmod{p}$ cannot be root of $f(x)$. Thus, for Hensel's Lemma, we have that $f(x)$ has exactly $2$ distinct roots modulo $p_i^{e_i}$, for all $i$.
Finally, the roots modulo $p$ are all the possible combinations of those ones and so they are exactly $2^k$.