Solve symmetric equations with 4 variables Is there a method to find or count the number of unique integer solutions $(n, H, L, W)$ to symmetric equations such as, 
$$x = 4n^2 + 2 + 4n(H + L + W) + 2HL + 2HW + 2LW$$
given $x$? All variables are positive integers.
I don't even know where to begin. Isolating one variable gives an ugly equation. For each solution $(H, L, W)$ the quadratic equation (and thus Pell's equation) can be used to see if $n$ is an integer, but that still involves brute forcing every possibility.
 A: For the equation:
$$x=4n^2+4n(H+L+W)+HL+HW+LW+1$$
You can record such decisions.
$$H=c$$
$$L=4d-c+1$$
$$W=12d^2-4dc+c^2+4d-c+x-1$$
$$n=-d$$
Or.
$$n=-12d^2+4dc-c^2-7d+c-x$$
A: There isn't any easy solution to the problem, but brute force suffices. 
Pick a limit for $x$ (in the code, MAX_CUBES). Define $c(n, H, L, W)$ as $x$ and iterate over $H, L, W, n$ with $0 \le H \le L \le W$ and $n \ge 1$. Break the loop when the limit is exceeded. In Python (easy rewrite in a compiled language for much more speed):
def c(n, H, L, W):
    return 4*n**2 + 2 + 4*n*(H + L + W) + 2*H*L + 2*H*W + 2*L*W

MAX_CUBES = 20000  # tuning
MAX_INT = MAX_CUBES
C = [0] * MAX_CUBES

for H in range(0, MAX_INT):
    if c(1, H, H, H) >= MAX_CUBES: break

    for L in range(H, MAX_INT):
        if c(1, H, L, H) >= MAX_CUBES: break

        for W in range(L, MAX_INT):
            if c(1, H, L, W) >= MAX_CUBES: break

            for n in range(1, MAX_INT):
                if c(n, H, L, W) >= MAX_CUBES: break

                C[c(n, H, L, W)] += 1

A: For the equation.
$$x=2n^2+2n(H+W+L)+HW+HL+WL+1$$
You can record such decisions.
$$H=d^2+10b^2+10c^2-6bd-6cd+16bc+10b+8c-3d+x+1$$
$$W=2d^2+20b^2+20c^2-12bd-12cd+32bc+30b+24c-9d+2x+9$$
$$L=2d^2+20b^2+20c^2-12bd-12cd+32bc+28b+26c-9d+2x+8$$
$$n=-(d^2+10b^2+10c^2-6bd-6cd+16bc+13b+11c-4d+x+3)$$
Or.
$$n=-(4d^2+40b^2+40c^2-24bd-24cd+64bc+55b+47c-17d+4x+15)$$
