4. A university has no more than 5000 registered students, of which $\frac{1}{3}$ are freshmen, $\frac{2}{7}$ are sophomores, $\frac{1}{5}$ are juniors, and the remainder are seniors. In the mathematics department's student list, freshmen account for $\frac{1}{40}$ of all freshmen in the university, sophomores account for $\frac{1}{16}$ of all sophomores in the university, juniors account for $\frac{1}{9}$ of all juniors in the university, and seniors account for $\frac{1}{3}$ of the mathematics department's students. Therefore, the mathematics department has ) students.
$\begin{array}{llll}\text { (A) } 181 & \text { (B) } 182 & \text { (C) } 183 & \text { (D) } 184\end{array}$
4. (C).

Let the total number of students in the school be $n$, and the number of students in the mathematics department be $c$. Then $\frac{1}{3} n$ are first-year students, $\frac{2}{7} n$ are second-year students, and $\frac{1}{5} n$ are third-year students. The number of first-year students in the mathematics department is $\frac{1}{40} \cdot \frac{1}{3} n$, the number of second-year students is $\frac{1}{16} \cdot \frac{2}{7} n$, and the number of third-year students is $\frac{1}{9} \cdot \frac{1}{5} n$. We have
$$
\begin{array}{l}
\frac{1}{40} \cdot \frac{1}{3} n+\frac{1}{16} \cdot \frac{2}{7} n+\frac{1}{9} \cdot \frac{1}{5} n=c-\frac{1}{3} c, \\
\frac{1}{120} n+\frac{1}{56} n+\frac{1}{45} n=\frac{2}{3} c .
\end{array}
$$

The least common multiple of $120$, $56$, and $45$ is $2520$, and $2 \times$ $2520>5000$, so $n=2520$. It is easy to find that $c=183$.