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.
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):