Hi everyone
Can anyone see why when a solution varible equals 1 the formating doesn't print, yet for all other numbers it seems fine. Here is the program in its entirety.
Do[a = Solve[(x^2 + y^2 + z^2)/3 == n^2 && y > 0 && x > 0 && z > 0 &&
x <= y && y <= z, {x, y, z}, Integers]; a = {x, y, z} /. a;
a = Flatten[a];
If[Length[a] > 3, a = Delete[a, {{-1}, {-2}, {-3}}];
a = Riffle[a, n, {4, -1, 4}]; a = Partition[a, 4];
If[Length[a] > 1,
Print["There are ", Length[a], " solutions when n = ", n]];
If[Length[a] == 1,
Print["There is ", Length[a], " solution when n = ", n]]; Do[Print[
\!\(\*SuperscriptBox[\(a[\([q, 1]\)]\), \("\<2\>"\)]\), " + ",
\!\(\*SuperscriptBox[\(a[\([q, 2]\)]\), \("\<2\>"\)]\), " + ",
\!\(\*SuperscriptBox[\(a[\([q, 3]\)]\), \("\<2\>"\)]\) " = ", "3x",
\!\(\*SuperscriptBox[\(n\), \("\<2\>"\)]\)], {q, 1, Length[a]}]], {n,
3, 20}]
As you can see there is no superscript printed when the number is 1.
Thanks in advance
Paul.