<s>[INST] Given $m$, find three numbers $a,b,c$ such that $c-b=m(b-a)$ and $a+b,a+c,b+c$ are all squares I've worked with the next problem


*

*Given an integer $m$, find three integers $a,b,c$, with $b\neq a$, such that $c-b=m(b-a)$ and 
$$a+b=x^2, \ \ a+c=y^2, \ \ b+c=z^2,$$
where $x,y, z \in \mathbb{Z}$.


I've not been able to give a result that guarantees the existence of solutions of this problem for some $m$ values.
Can you help me, please?
 [/INST] The condition requires $$y^2-x^2=m(z^2-y^2)$$ or $$x^2-(m+1)y^2=-mz^2.$$ 
You also require $x+y+z$ even, and then you get $$a=\frac{x^2+y^2-z^2}{2},b=\frac{x^2+z^2-y^2}{2},c=\frac{y^2+z^2-x^2}{2}.$$
But there is a general approach to finding all rational solutions to:
$$aX^2+bY^2=c$$
if you have one rational solution.
Here, we have $(a,b,c)=(1,-(m+1),-m)$. and base solution $(X_0,Y_0)=(1,1)$.
Then if $p,q$ are integers, not both zero, then there is another rational solution $(X,Y)=(X_0+pt,Y_0+qt)$ with $t\neq 0$.
Solving, we get $$(1+pt)^2-(m+1)(1+qt)^2=-m\\
2pt + p^2t^2  -2(m+1)qt-(m+1)q^2t^2=0\\
2t\left[p-q(m+1)\right] + t^2\left[p^2-(m+1)q^2\right]=0$$
Assuming $t\neq 0$, you have:
$$t=\frac{2q(m+1)-2p}{p^2-(m+1)q^2}$$
This obviously has problems if $p^2-(m+1)q^2=0$, which can happen when $m+1$ is a perfect square.
Also, if $q=1,p=m+1$ then the numerator is zero, so doesn't give a new solution, but that's okay.
Now $$1+pt = \frac{(m+1)q(2p-q)-p^2}{p^2-(m+1)q^2}\\
1+qt=\frac{(m+1)q^2+p(p-2q)}{p^2-(m+1)q^2}
$$
Then any time $(m+1)q+p$ is even, and $p^2-(m+1)q^2\neq 0$ you get the solution:
$$(x,y,z)=\left((m+1)q(2p-q)-p^2,(m+1)q^2+p(p-2q),p^2-(m+1)q^2\right)$$
Trying $(p,q)=(4,2)$ you get:
$$(x,y,z)=(6m+2,2m+2,6-2m)\\(a,b,c)=(18m^2+4m-14,18m^2-28m+18,-14m^2+4m+18)$$
The general formula gives (I think, still needs checking):
$$a=2\left[(q-2p)^2q^2(m+1)^2-(4q^2-6qp+4p^2)pq(m+1)+p^2(p-2q)^2\right]\\
b=2\left[(q-2p)^2q^2(m+1)^2-(4p^2-2pq+4q^2)pq(m+1)+(p^2+4pq-4q^2)p^2\right]\\
c=2\left[(q^2+4pq-4p^2)q^2(m+1)^2+(4p^2+6pq+4q^2)pq(m+1)+p^2(p+2q)^2\right]
$$
</s>