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.
About the solutions of the above equation 
$$X² + aX + Y² + bY = Z² + cZ$$

$$X = (k-1)((a + b)k + a - c)s² - (ck - b)ps$$

does not work.

This is a counterexample  :
$$X = 3$$
$$a = 6$$
$$Y = 6$$
$$b = 30$$
$$Z = 3$$
$$c = 78$$

In this case :
$$3 = (k - 1)(36k - 72) s² - (78k - 30)ps$$
$$=&gt; (k -1)(12k - 24)s² - (26k - 10) ps = 1$$
$$=&gt; s[(k -1)(12k - 24)s - (26k - 10) p] = 1$$
$$=&gt; (k -1)(12k - 24) - (26k - 10) p = 1, (s = 1)$$
$$=&gt; 2[(k -1)(6k - 12) - (13k - 5) p] = 1$$
$$=&gt; 2 = 1, impossible$$
Solving this equation turned out rather unexpected result.

As is well known equation of the form: $aX^2+cY^2=jZ^2$

as you know is not always the solution in integers.

But such an equation: $aX^2+bX+cY^2+qY=jZ^2+dZ$

will always have a solution integers. 
At least you can always write a formula.

That's quite unexpected and it is not clear result.

Decisions will always be the coefficients $b,q,d$ - at least one non-zero.