Curves triangular numbers. Sometimes you have to deal with this equation: $X^2+aX+Y^2+bY=Z^2+cZ$
$a,b,c$ - integer coefficients.
I wrote below - to start a particular solution of Diophantine equations.
To do this, use the solutions of Pell's equation: $p^2-2k(k-1)s^2=1$
I turned solutions such.
$X=(k-1)((a+b)k+a-c)s^2-(ck-b)ps$
$Y=k((a+b)k+c-a-2b)s^2-(ck+a-c)ps$
$Z=(2ck^2+(a-b-2c)k+c-a)s^2-((a+b)k-b)ps$
And more:
$X=(c-a-b)p^2+(k(3c-2a-2b)+2a+b-2c)ps+(k-1)((2c-a-b)k+a-c)s^2$
$Y=(c-a-b)p^2+(k(3c-2a-2b)+a-c)ps+k((2c-a-b)k+a-c)s^2$
$Z=(c-a-b)p^2+(k(4c-3a-3b)+2a+b-2c)ps+(2k-1)((2c-a-b)k+a-c)s^2$
Probably will have to write a more general formula. But I think that's not a problem.
Here is another question. When trying to solve the more general equation:
$nX^2+aX+qY^2+bY=jZ^2+cZ$
Always turns in decisions that need to share the decision itself by type: $w=n+q-j$
That is, the formula is written as a fraction. Certainly at Pell's equation infinitely many solutions. And of course no matter how large the number it was not always a chance that the fraction reduced. But still not clear how all of these decisions to allocate whole?  Although there may be another idea to solve this equation and all that there is no need to do?
The coefficients should have this appearance. Because they will appear as unknown for other equations.

The interesting thing is that the equation: $aX^2+bX+cY^2+qY=jZ^2+dZ$
If we use the equation Pell: $p^2-rs^2=1$
Coefficient is defined as follows: $r=(a+c)jk^2-2cjkt+(j-a)ct^2$
$k,t$ - integers asked us.  Then the solutions are of the form:
$X=(qt-dk)ps+((b+q)jk^2-(dc+qj)kt-(b-d)ct^2)s^2$
$Y=((d-b)t-dk)ps+((b+q)jk^2+(ad-(b+2q)j)kt+(j-a)qt^2)s^2$
$Z=(qt-(b+q)k)ps+((a+c)dk^2+((b-2d)c-aq)kt-(b-d)ct^2)s^2$
And another formula.
$X=\frac{1}{a+c-j}[(d-b-q)p^2+(((a+c+j)d-2(b+q)j)k+((j+c-a)q+2(b-d)c)t)ps+$
$+(j((a+c)d-(b+q)j)k^2+(2bcj+(j+c-a)jq-(a+c+j)cd)kt-$
$-c((b-d)c+(j-a)q)t^2)s^2]$
...........................................................................................................................................
$Y=\frac{1}{a+c-j}[(d-b-q)p^2+((a+c+j)d-2(b+q)j)k+(2(j-a)q+$$(j+c-a)(b-d))t)ps+$
$+(j((a+c)d-(b+q)j)k^2+(((a+c-j)a-2cj)d+(j+c-a)jb+2j(j-a)q)kt+$
$+(a-j)((b-d)c+(j-a)q)t^2)s^2]$
...........................................................................................................................................
$Z=\frac{1}{a+c-j}[(d-b-q)p^2+$$((2(a+c)d-(a+c+j)(b+q))k+((j+c-a)q+2(b-d)c)t)ps+$
$+((a+c)((a+c)d-(b+q)j)k^2+((a+c+j)cb-2(a+c)cd+(2cj-(a+c-j)a)q)kt-$
$-c((b-d)c+(j-a)q)t^2)s^2]$
In the second formula should be chosen so Pell's equation and its solution so that the fraction decreased and turned to an integer.
