For each integer $n \ge 2$, let $A(n)$ be the area of the region in the coordinate plane defined by the inequalities $1\le x \le n$ and $0\le y \le x \left\lfloor \sqrt x \right\rfloor$, where $\left\lfloor \sqrt x \right\rfloor$ is the greatest integer not exceeding $\sqrt x$. Find the number of values of $n$ with $2\le n \le 1000$ for which $A(n)$ is an integer.
Let $n\ge 2$ and define $a(n) = \left\lfloor \sqrt n \right\rfloor$. For $2\le n \le 1000$, we have $1\le a(n)\le 31$. For $a^2 \le x < (a+1)^2$ we have $y=ax$. Thus $A(n+1)-A(n)=a(n+\tfrac 12) = \Delta_n$ (say), and $\Delta_n$ is an integer if $a$ is even; otherwise $\Delta_n$ is an integer plus $\tfrac 12$. If $a=1$, $n\in \{1,2,3\}$ and $\Delta_n$ is of the form $k(n)+\tfrac 12$ so $A(n)$ is an integer when $n$ is even. If $a=2$, $n\in\{4,\ldots , 8\}$ and $\Delta_n$ is an integer for all $n$. Since $A(3)$ is not an integer, so $A(n)$ is not an integer for any $n$. If $a=3$, $n\in\{9,\ldots , 15\}$ and $\Delta_n$ is of the form $k(n)+\tfrac 12$. Since $A(8)$ is of the form $k+\tfrac 12$ so $A(n)$ is an integer only when $n$ is odd. If $a=4$, $n\in\{16,\ldots , 24\}$ and $\Delta_n$ is an integer for all $n$. Since $A(15)$ is an integer so $A(n)$ is an integer for all $n$. Now we are back to where we started; i.e., the case $a=5$ will be the same as $a=1$ and so on. Thus, \begin{align} a(n)\equiv 1\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for even } n, \\ a(n)\equiv 2\pmod 4 \qquad &\Longrightarrow \qquad A(n) \not\in \mathbb{Z} \textrm{  for any } n, \\ a(n)\equiv 3\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for odd  } n, \\ a(n)\equiv 0\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for all } n. \end{align} For each $a$ there are $2a+1$ corresponding values of $n$: i.e., $n\in \{a^2, \ldots , (a+1)^2-1\}$. Thus, the number of values of $n$ corresponding to $(4)$ (i.e., $a(n)\equiv 0\pmod 4$) is given by \[\sum_{\substack{a=4k \\ a\le 31}}(2a+1) = \sum_{k=1}^7 (8k+1)=231.\] The cases $(1)$ and $(3)$ combine to account for half the values of $n$ corresponding to odd values of $a(n)$; i.e., \[\frac 12 \cdot \sum_{\substack{a=2k+1 \\ a\le 31}} (2a+1) = \sum_{k=0}^{15} (2k+\tfrac 32) = 264\]However, this also includes the odd integers in $\{1001, \ldots , 1023\}$. Subtracting $12$ to account for these, we get the  number of values of $n$ corresponding to cases $(1)$ and $(3)$ to be $264-12=252$. Adding the contributions from all cases we get our answer to be $231+252= \fbox{483}$.