Hello all, I try to put all outputs in a set. Unfortunately I cannot it. Here is the program:
p = 7;
Do[
Do[
If[t^2 + t*k + k^2 == p, {a = t, b = k}]
, {t, 1, p}]
, {k, 1, p}]
tt = a + b - 1;
Do[If[Mod[a + b*s, p] == 0, r = s], {s, 0, p - 1}]
Do[Do[If[Mod[x + y*r, p] == 0 &&
Min[Abs[x] + Abs[y]] < Abs[tt] + Abs[tt], Print[x]],
{x, -tt, tt}],
{y, -tt, tt}]
the outputs seems as -1,0,1. I want to obtain the outputs as {-1,0,1}. How can I do that? Thanks in advanced