How many $n$'s can make $4m^2-n^2$ a perfect square? And, triple of a perfect square? As the title reads. Given an integer $m\ge1$, how to calculate the number of integer $n$'s ($1\le n\le 2m$) such that $4m^2-n^2$ is a perfect square? Thank you~
Update: Further, how many pairs $(n,z)$ satisfy $4m^2-n^2=3z^2$ ?
 A: There is a large literature on the number of representations of $k$ as a sum of two squares.  The formulas are simplest if we count the ordered pairs $(x,y)$ of integers, which need not be $\ge 0$, such that $x^2+y^2=k$. The number of such representations is usually denoted in the literature by $r_2(k)$, or more simply $r(n)$.  But there are also related expressions that count the number of unordered pairs of non-negative integers $x$, $y$ such that $x^2+y^2=k$.  Your question asks about unordered pairs of non-negative integers, in the case $k=4m^2$. 
Most books on elementary number theory have some discussion of the number of representations as a sum of two squares.  There is also quite a bit of online information. One might begin by looking at Wolfram MathWorld. 
The standard general formula can be easily specialized to the case $k=4m^2$.  Let 
$$m=C p_1^{a_1}p_2^{a_2} \cdots p_s^{a_s},$$
where the $p_i$ are distinct primes of the form $4u+1$, and $C$ is not divisible by any prime of the form $4u+1$. Then the number of unordered pairs $x$, $y$ of non-negative integers such that $x^2+y^2=4m^2$ is equal to 
$$\frac{(2p_1+1)(2p_2+1)\cdots (2p_s+1)+1}{2}.$$ 
For extremely large $m$, the above formula, though explicit, may not be very helpful, because of the computational cost of factoring. 
