945 = a^2 - b^2 = (a+b)(a-b)
Let x = a+b and y = a-b. Hence, xy = 945. So we need to find all the product combinations that result in 945
Factorize 945 = 3*3*3*5*7 = 3^3 * 5^1 * 7^1
Total number of factors = (3+1)(1+1)(1+1) = 16.
Possible combinations of (x,y)
(1,945), (3,315), (5,189), (7,135), (9,105), (15,63), (21,45), (27,35), (35,27), (45,21), (63,15), (105,9), (135,7), (189,5), (315,3), (945,1) = 16 pairs. Becasue there are 16 different factors, there can only be 16 ordered pairs of x and y.
The above pairs can be in negatives as well ((-1,-945), (-3,-315)...) which will give me another 16 pairs. For each of these pairs, there will be one unique value of a and b (as shown in a few examples below) and hence there will be
32 ordered pairs of a and b in total.
Ex1. x = 945, y = 1. a = 473 and b = 472. Hence x = (473+472), y = (473-472) and (473+472)(473-472) = 945Ex2. x = 315, y = 3. a = 159 and b = 156. Hence x = (159+156), y = (159-156) and (159+156)(159-156) = 945