For the equation: $$a^2+pb^2+(p+k^2)z^2=2c^2+2kcz$$ If the number $k$ is the problem any, and $p$ is such as this: $p=\frac{t^2}{2}-1$ Then the solution can be written: $$a=\pm{t}n^2+2(tpr\mp(p+1)kj)ns-(2p(p+1)kjr\pm{t}((p+1)(p+k^2)j^2+pr^2))s^2$$ $$b=\pm{t}n^2-2(tr\pm(p+1)kj)ns+(2(p+1)kjr\mp{t}((p+1)(p+k^2)j^2+pr^2))s^2$$ $$z=2(p+1)j((p+1)kjs-tn)s$$ $$c=(p+1)(n^2+((p+1)(p+k^2)j^2+pr^2)s^2)$$ $n,s,j,r$ - integers which we are set. If you can represent numbers as: $p=3k^2-t^2$ This decision when the coefficients are related through the equation of Pell. $t^2-3k^2=-p$ To simplify calculations we will make this change. $$x=(\pm{t}-2k)n^2+2j(t\mp3k)ns-(2kj^2+2kpe^2\pm{t}(pe^2-2j^2))s^2$$ $$y=(\pm{t}-2k)n^2+2j(2t\mp3k)ns-(8kj^2+2kpe^2\pm{t}(pe^2-2j^2))s^2$$ $$r=2e(tn-3kjs)s$$ $$f=n^2+(pe^2-2j^2)s^2$$ Then the solution can be written: $$a=pr^2+(p+k^2)f^2-xy$$ $$b=r(x+y)$$ $$z=f(x+y)$$ $$c=pr^2+(p+k^2)f^2+x^2$$ $n,s,e,j$ - integers which we ask.