Question on the below system of equations:
First off, in section 1 below, I had to manually play with that 4th parameter (300) so I can finally see that there are actually 96 sets of solutions. Is there a way that I do not provide that and Mathematica tells me there are 96? If I remove the parameter I only get 1 set. As I increase it, I eventually see that beyond 96, no matter how high I go it stops at 96.
Second, in section 2 below, I see the CountDistinct gives me the total number of sets. But if you pay attention there are only 4 unique sets (3,21,27,29), (9,11,27,33), (7,13,29,31), (11,13,19,37) - But there are 24 permutations for each set, since the 4 vars are interchangeable, hence 24*4=96 total). How can I ask Mathematica to also list these 4 unique sets?
eqn = FullSimplify[{w + x + y + z == 80, w^2 + x^2 + y^2 + z^2 == 2020}]
Table[FindInstance[eqn, {w, x, y, z}, Integers, 300] ]
{{w -> 3, x -> 21, y -> 27, z -> 29}, {w -> 3, x -> 21, y -> 29,
z -> 27}, {w -> 3, x -> 27, y -> 21, z -> 29}, {w -> 3, x -> 27,
y -> 29, z -> 21}, {w -> 3, x -> 29, y -> 21, z -> 27}, {w -> 3,
x -> 29, y -> 27, z -> 21}, {w -> 7, x -> 13, y -> 29,
z -> 31}, {w -> 7, x -> 13, y -> 31, z -> 29}, {w -> 7, x -> 29,
y -> 13, z -> 31}, {w -> 7, x -> 29, y -> 31, z -> 13}, {w -> 7,
x -> 31, y -> 13, z -> 29}, {w -> 7, x -> 31, y -> 29,
z -> 13}, {w -> 9, x -> 11, y -> 27, z -> 33}, {w -> 9, x -> 11,
y -> 33, z -> 27}, {w -> 9, x -> 27, y -> 11, z -> 33}, {w -> 9,
x -> 27, y -> 33, z -> 11}, .....
...(snip)....
{w -> 33, x -> 27, y -> 9, z -> 11}, {w -> 33, x -> 27, y -> 11,
z -> 9}, {w -> 37, x -> 11, y -> 13, z -> 19}, {w -> 37, x -> 11,
y -> 19, z -> 13}, {w -> 37, x -> 13, y -> 11, z -> 19}, {w -> 37,
x -> 13, y -> 19, z -> 11}, {w -> 37, x -> 19, y -> 11,
z -> 13}, {w -> 37, x -> 19, y -> 13, z -> 11}}
CountDistinct[Table[FindInstance[eqn, {w, x, y, z}, Integers, 300] ]]
{96, 4}
-Thanks