Which integers can be represented as the most pair of difference of two squares? Let $f(x)$ be the number of $a,b,x\in \mathbb N$ where $a^2-b^2=x$.
For example, 1971 is not only $986^2-985^2$ but also $50^2-23^2$, $114^2-105^2$, $330^2-327^2$. So, $f(1971)=4$. Is there some sort of limit to $f(x)/x$ or $f(x)/ln(x)$ or similar? For which kind of $x$?
 A: We're looking for the size of the set $S$ of ordered pairs $(a, b)$ with $a, b \geq 0$ and $a^2 - b^2 = (a + b)(a - b) = x$ for some fixed $x > 0$. (Removing the 'ordered' bit is trivial, since any such pair has $a > b$. Also, we can dispense with the case $x = a^2$ separately if we want to include the case $b = 0$.) Let $S'$ denote the set of ordered pairs $(n, m)$ with $n \geq m > 0, nm = x,$ and $n\equiv m\pmod{2}$. Then the map $f:S \to S'$ given by $f(a, b) = (a + b, a - b)$ is a bijection, with inverse $f^{-1}(n, m) = \frac{1}{2}(n + m, n - m)$. 
Suppose for simplicity that $x$ is not a perfect square. Now note that
\begin{align*}
\#S' = \frac{1}{2}\#\left\{n > 0:\, n|x\text{ and } n \equiv x/n\!\!\!\!\pmod{2}\right\}
\end{align*}
If $x$ is odd, then the equivalence above holds for any $n$, and $\#S = \#S' = \frac{1}{2} d(n)$, where $d$ denotes the number of divisors of $n$. If instead $x = 2^p x'$ with $p > 0$ and $x'$ odd, then the equivalence holds iff $n = 2^r n'$ with $n' | x'$ odd and $r\not = 0, p$. Thus 
\begin{align*}
\#S = \#S' = \begin{cases}
0 & \text{ if $p = 1$;} \\
\frac{1}{2}(p - 1) d(x') & \text{ if $p \not = 1$} \\
\end{cases}
\end{align*}
Since $d$ is multiplicative, we have $d(2^p x') = d(2^p) d(x') = (p + 1)d(x')$. Thus we can combine the previous results to give
\begin{align*}
\#S &= \frac{1}{2}\left(\frac{p-1}{p+1}\right) d(x)
\end{align*}
where $2^p$ is the highest power of $2$ dividing $x$. 
A: Partial answer. If $x$ is odd, then $a=(x+1)/2$, $b=(x-1)/2$, satisfy $x=a^2-b^2$.
If $x$ is even, and $a$, $b$ exist, so that $x=a^2-b^2$, then $x=(a-b)(a+b)$, and clearly, both $a+b$, $a-b$ are even, and hence $x$ is divisible by $4$. Then, $a=(x+4)/4$ and $y=(x-4)/4$, satisfy $x=a^2-b^2$.
Note that in the first case $x\ge 3$, and in the second $x\ge 8$.
So $x$ is either odd $\ge 3$ or multiple of 4 and $x\ge 8$.
A: Let, 
$$d(x) = \text{the number of divisors of x}$$ 
$$d_e(x) = \text{the number of even divisors of x}$$ 
$$d_0(x) = \text{the number of odd divisors of x}$$ 
It seems for non-square $x=4m$, then,
$$f(x) = \frac{d\big(\tfrac{x}{4}\big)}{2} = \frac{d_e(x)-d_0(x)}{2}\tag1$$
For example, using the divisor function of Mathematica, the formulas yields for $x=221760$,
$$f(221760)= \frac{d\big(\tfrac{x}{4}\big)}{2} = \frac{120}{2}=60$$
$$f(221760)= \frac{d_e(x)-d_0(x)}{2} =\frac{144-24}{2}=60$$
which is the same value found by the OP. Thus, $f(x)$ can be as high as one wants by using highly composite numbers as the OP correctly surmised.
P.S. I can't rigorously prove $(1)$, though I'm sure someone in this forum can.
