For a given height $N$. I am performing various sums involved in the counting of the number of monic quadratics, cubics, etc. that factor over a range. I noticed by experiment that the above sum over the number of quadratic discriminates that are perfect squares is equal to the sum of the number of divisors minus 1 or $D \left(N\right) - 1$. The original form was $$\sum_{u = 1}^{N} \sum_{v=1}^{N} \left[\sqrt{u^2-4v} \in Z\right]+ \sum_{u = 1}^{N} \sum_{v=-N}^{-1}\left[\sqrt{u^2-4v} \in Z\right] = D \left(N\right)-1.$$ The case when $v=0$ has been factored out as $N$.
I have not seen any similar expressions in the literature. I am looking for a proof of this or suggestions.
Further numerical tests for a given $u$ has shown that the inner sum is the number of divisors of $u$ with a modification at the last value or
$$\sum_{v=1}^{N} \left(\left[\sqrt{u^2-4v} \in Z\right] + \left[\sqrt{u^2+4v} \in Z\right]\right) = \begin{cases} \tau \left(u\right), & u < N, \\ \tau \left(u\right) - 1, & u = N \end{cases}$$
where $\tau \left(u\right)$ is the number of divisors. A table of the inner sum for the values of $u=20$ as v varies from 1 to 20 is shown below
$$\begin{matrix} v & S & [u^2-4v \in Z] & [u^2+4v \in Z] & \tau \left(v\right) \\ 1 & 1 & 1 & 0 & 1 \\ 2 & 2 & 1 & 1 & 2 \\ 3 & 2 & 1 & 1 & 2 \\ 4 & 3 & 2 & 1 & 3 \\ 5 & 2 & 1 & 1 & 2 \\ 6 & 4 & 2 & 2 & 4 \\ 7 & 2 & 1 & 1 & 2 \\ 8 & 4 & 2 & 2 & 4 \\ 9 & 3 & 2 & 1 & 3 \\ 10 & 4 & 2 & 2 & 4 \\ 11 & 2 & 1 & 1 & 2 \\ 12 & 6 & 3 & 3 & 6 \\ 13 & 2 & 1 & 1 & 2 \\ 14 & 4 & 2 & 2 & 4 \\ 15 & 4 & 2 & 2 & 4 \\ 16 & 5 & 3 & 3 & 5 \\ 17 & 2 & 1 & 1 & 2 \\ 18 & 6 & 3 & 3 & 6 \\ 19 & 2 & 1 & 1 & 2 \\ 20 & {5}^{*} & {2}^{*} & 3 & 6 \\ \end{matrix}$$
where $S$ is the sum of the two inversion brackets along with the two partial inversion bracket sums with the last column being the number of divisors which shows the -1 correction. If the inner sum result is proved then the final sum follows.
The series for $\left[\sqrt{u^2-4v} \in Z\right]$ is identified as A038548 of the On-Line Encyclopedia of Integer Sequence except for the last entry as described above which is also noted to be $\left\lceil{\tau \left(u\right)}\right/2\rceil$ and the series for $\left[\sqrt{u^2+4v} \in Z\right]$ is identified as A056924 which is also noted to be $\left\lfloor{\tau \left(u\right)}\right/2\rfloor$. No proofs are noted.
This problem looks to be counting the solutions of Pell like equations: Count the number of solutions of $u^2-n^2=\pm 4v$ within the constraints of $u$ and $v$.