I recently came across this question (Show that $\sqrt{1+n(n+1)(n+2)(n+3)}$ is a whole number for all whole numbers n), and as is my wont, I tried to solve the question for myself before looking at the provided answers. I began by using modular approaches, and confirmed to myself that for several small moduli, numbers of the form $f(n)=1+n(n+1)(n+2)(n+3)$ are always congruent to squares. When I looked at the given answers, that $f(n)$ can be expressed algebraically as a square, it became clear why my calculations came out as they did: square numbers will always be congruent to squares with regard to any modulus.
This led me to wonder: If some formulaic number $g(n)$ is demonstrably congruent to a square by a plurality of prime moduli, is it true that $g(n)=k^2$? It is plain that $\bmod 2$ renders numbers trivially congruent to $0,1$, so let's restrict ourselves to prime moduli $\ge 5$.
I have argued this several times to myself, and I arrive at both possible answers, yes and no. So my (lengthy, convoluted, and empirically inconsistent) thinking is plainly muddled somehow or somewhere.
My question is: Is there any (minimum) number of prime moduli $\ge 5$ such that: $\forall n,\ g(n)\equiv a^2 \bmod p_i \Rightarrow g(n)=k^2$?
No, there is no finite set of prime moduli you can check to confirm that $g(n)$ is a square polynomial.
Take $p = \text{max}(p_1,p_2,\ldots p_k)$ and $M \geq p$ such that $M+2$ is a perfect square. Now, consider the polynomial $g(n)= n(n+1)(n+2)\cdots (n+M)+1$ Clearly for all $n$, $g(n) \equiv 1 \pmod{p_i}$ which is definitely a quadratic residue. If $g(n)$ were a square polynomial, both $g(1)= (M+1)!+1$ and $g(2)=(M+2)!+1$ would have to be squares.
$$ \begin{align} (M+2)! +1 &= b^2 \\ (M+2)\cdot (M+1)!+1 &= b^2 \\ (M+2)(a^2-1)+1 &= b^2 \\ (M+2)a^2-M-1 &= b^2 \\ k^2a^2-M-1 &= b^2 \end{align} $$
But since $a \gt M$, $(ka-1)^2 \lt k^2a^2-M-1 \lt k^2a^2$ which contradicts the assertion that both $g(1)$ and $g(2)$ are squares. Therefore, $g(n)$ is not a square polynomial.
(It would have been easier to consider $g(n)=n(n+1) \cdots (n+M)$ but I wanted to avoid a polynomial that always evaluates to $0 \bmod p_i$).