How can I solve the equation with integers as a solution?
A geometrical view of the solutions:
s = Solve[(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 49, {x, y, z}, Integers];
pts = {x, y, z} /. s;
subs = Subsets[pts, {2}];
minds = Union[dists = N[EuclideanDistance @@@ subs]][[1 ;; 3]];
Show[Graphics3D[Sphere[{1, 1, 1}, 13/2]],
Graphics3D[Line /@ Extract[subs, Position[dists, Alternatives @@ minds]]],
ListPointPlot3D[pts, PlotStyle -> Directive[PointSize[Medium], Red]],
Boxed -> False]
Edit
Another useful visualization:
s = Solve[(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 49 &&
x != 1 && y != 1 && z != 1, {x, y, z}, Integers];
pts = {x, y, z} /. s;
w = Sqrt@13;
f[i_, k_] := RotateLeft[{w Cos@u, w Sin@u, k} + {1, 1, 0}, i];
Show[Graphics3D[Sphere[{1, 1, 1}, 13/2]],
ParametricPlot3D[Flatten[{f[1, #], f[2, #], f[3, #]} & /@ {-5, 7}, 1], {u, 0, 2 Pi}],
ListPointPlot3D[pts, PlotStyle -> Directive[PointSize[Large], Red]],
Boxed -> False]
Edit
Note that the problem turns religious if you use 81
instead of 49
:
Try :
Solve[(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 49, {x, y, z}, Integers]
or
Reduce[(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 49, {x, y, z}, Integers]
You can add inequalities as well as :
Solve[{(x - 1)^2 + (y - 1)^2 + (z - 1)^2 == 49, x != 1, y != 1, z != 1}, {x, y, z}, Integers]