I look for computing this cardinality: $$N(q)=\#\{n \in \mathbb{N} \ | \ \gcd(n^2+1, \prod_{\substack{p \leqslant q \\ \text{p prime}}}p)=1 , \ \ n^2+1 \leqslant \prod_{\substack{p \leqslant q \\ \text{p prime}}}p \},$$ 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 : $$\left\{ \begin{array}{cl} 0 & \text{ if } p = 3 \pmod 4 \\ 2 & \text{ if } p = 1 \pmod 4 \end{array} \right.$$
Using Chinese remainder theorem and fundamental counting principle i get this result: $$N(q) = \bigg(\prod_{\substack{p \leqslant q \\ p \equiv 3[4] \\ \text{p prime}}}p \bigg)\prod_{\substack{p \leqslant q \\ p \equiv 1[4] \\ \text{p prime}}}(p-2) \tag{1}$$ Formula $(1)$ is not correct when i check $N(q)$ numerically.
The true values are : $$N(7)=5, \ N(11)=15, \ N(13)=45 , \ N(17)=161, \ N(19)=698, \cdots$$
Question: Why my formula $(1)$ is not correct !? and what is the correct formula ?
Many thanks for any help.
EDIT: Numerically it's very likely that: $$N(q) \approx \dfrac{1}{\sqrt{\displaystyle \prod_{\substack{p \leqslant q \\ \text{p prime}}}p }} \, \bigg(\prod_{\substack{p \leqslant q \\ p \equiv 3[4] \\ \text{p prime}}}p \bigg)\prod_{\substack{p \leqslant q \\ p \equiv 1[4] \\ \text{p prime}}}(p-2)$$
You’re counting the set with the restriction $n\le\prod_{p\le q}p$ rather than $n^2+1\le\prod_{p\le q}p$.
The estimate in your last line makes sense if we think of the elements as uniformly randomly distributed, since $N(q)$ counts approximately a proportion $\left(\prod_{p\le q}p\right)^{-\frac12}$ of the elements.