Is there a method to solve the following diophantine equation: $2x^2+2y^2+2z^2 +u^2 +v^2 = N$?

143 Views Asked by At

Just to give a simple numerical example but in general the variables $x,y,z,u,v$ are not equal.

$113= 2*4^2 + 2*4^2 +2*4^2 + 4^2 +1^2$

I am looking for a general method to solve this type of equation or a piece of software to do the same. I already looked in this site for methods that could help but could not find anything dealing with this ind of case.

Question 2 It is also useful to know if there is a test that can tell if the equation does not have a solution.

2

There are 2 best solutions below

3
On BEST ANSWER

Here is some brutal code (understand not optimized at all) to get all solutions as a verification.

Since $x,y,z$ and $u,v$ are symmetric, I did not print the shuffles.

There is always at least one solution if we allow some of the variables to be zero:

It seems to me with $5$ unknowns there is plenty of room to have solutions, so it might be difficult to express them all unless using brute force.

0
On

$$ u^2 + v^2 +2 x^2+ 2 y^2 $$ is positive universal. Thus, take $$ z = \left\lfloor \sqrt \frac{N}{2} \right\rfloor $$

after which $N- 2 z^2$ is fairly small, search any way you like in finishing $$ N - 2 z^2 = u^2 + v^2 +2 x^2+ 2 y^2 $$