I posted the question here but I got no response.
I am looking for computing this cardinality: $$N(q)=\#\Bigg\{n \in \mathbb{N} \ | \ \gcd\bigg(n^2+1, \prod_{\substack{p \leqslant q \\ p\text{ prime}}}p\bigg)=1 , \ \ n^2+1 \leqslant \!\!\!\prod_{\substack{p \leqslant q \\ p\text{ prime}}}\!\!p \Bigg\},$$ by using Chinese remainder theorem.
First, for $p$ odd prime and $m\in\mathbb{Z}/p\mathbb{Z}$, the number of solutions of the equation $m^2 + 1 = 0 \pmod p$ is : $$ \begin{cases} 0 & \text{ if } p = 3 \pmod 4 \\ 2 & \text{ if } p = 1 \pmod 4 \end{cases}.$$
Using the Chinese remainder theorem and the fundamental counting principle, I get this result: $$N(q) = \bigg(\prod_{\substack{p \leqslant q \\ p \equiv 3[4] \\ p\text{ prime}}}p \bigg)\prod_{\substack{p \leqslant q \\ p \equiv 1[4] \\ p\text{ prime}}}(p-2) \label{1}\tag{1}$$ Formula \eqref{1} seems not correct as when I check $N(q)$ numerically I do not get the same results as by counting.
The true values are : $$N(7)=5, \ N(11)=15, \ N(13)=45 , \ N(17)=161, \ N(19)=698, \cdots$$
Question: Why my formula \eqref{1} is not correct !? And what is the correct formula ?
Many thanks for any help.
Numerically it's very likely that: $$N(q) \approx \dfrac{1}{\sqrt{\displaystyle \prod_{\substack{p \leqslant q \\ p\text{ prime}}}p }} \, \bigg(\prod_{\substack{p \leqslant q \\ p \equiv 3[4] \\ p\text{ prime}}}p \bigg)\prod_{\substack{p \leqslant q \\ p \equiv 1[4] \\ p\text{ prime}}}(p-2)$$