What is the order of this set? (Number theory) $A= \{ n \in \mathbb{N} \vert 337 \leq n \leq 2022$, $\binom{n}{337}\equiv3(mod337)\}$. Find the $\vert A \vert$
$(sol)$ $\binom{n}{337}$ $= \frac{n(n-1)(n-2)...(n-336)}{(337)!}$
By Wilson, $\frac{n(n-1)(n-2)...(n-336)}{(337)!} \equiv (-1)\frac{n(n-1)(n-2)...(n-336)}{337}$
$\forall$ fixed $n(\geq 337)$, $n(n-1)...(n-336) \equiv 1 \cdot 2 .... \cdot 337$  because of the 337 numbers are multiplied consecutively.
Considering the field $ \mathbb{Z_{337}}$ and applying the Wilson thm again, $(-1)\frac{n(n-1)(n-2)...(n-336)}{337} \equiv (-1)(336!) \equiv 1 $ for $mod 337$
My answer is $\vert A \vert =0$ since the $A = \phi$ from the  $\binom{n}{337}$ $= \frac{n(n-1)(n-2)...(n-336)}{(337)!} \equiv 1 (mod 337)$
But the answer was 337
I can’t understand why the answer should that be. Plus Which point did I wrong? Is my solution is right?
Thanks.
 A: Your mistake is where you stated

$\forall$ fixed $n(\geq 337)$, $n(n-1)...(n-336) \equiv 1 \cdot 2 .... \cdot 337$  because of the 337 numbers are multiplied consecutively.

Technically, it's true modulo $337$ because both sides are congruent to $0$. However, after dividing both sides by $337$, then the congruence is not always correct. This is because you are not accounting for the multiplier of the factor which is a multiple of $337$. For a simpler example, consider $n = 8$ modulo $3$. This gives
$$\frac{8(7)(6)}{3} \equiv \frac{(2)(1)(2)(3)}{3} \equiv (1)(2)(2) \pmod{3} \tag{1}\label{eq3A}$$
As you can see, there's an extra factor of $2$ due to $6 = 2(3)$. In your case, this means any values where any $3(337) \le n \lt 4(337)$ would leave a congruence of $3$. Since $2022 = 6(337)$, all such values are included, giving $337$ of them.

Note that Lucas's theorem provides a simpler way to determine this. In base $337$, we have $n = k(337) + r$ and, of course, $337 = 1(337) + 0$. Thus, since $337$ is prime, this theorem states that
$$\begin{equation}\begin{aligned}
\binom{n}{337} & \equiv \binom{k}{1}\binom{r}{0} \\
& \equiv (k)(1) \\
& \equiv 3 \pmod{337}
\end{aligned}\end{equation}\tag{2}\label{eq2A}$$
This shows $k = 3$, with $r$ having no effect. Thus, this gives the same result as explained earlier, i.e., the $n \in A$ are $n = 3(337) + r$ for $0 \le r \lt 337$, so $\vert A \vert = 337$.
