Finding $n$ elements of $\mathbb{Z}_n\times\mathbb{Z}_n$ such that their differences are all different

We shall call a natural number $n$ good provided a group $\Bbb Z_n\times\Bbb Z_n$ has a Sidon set of size $n$. In this joriki proved that each odd prime is good.

We claim that each odd square-free number is good. To show this it suffices to show that a product of any two coprime good numbers $n$ and $m$ is good. It is easy to see that an element $(1,1)$ of a product $\Bbb Z_m\times Z_n$ has order $mn$, so $\Bbb Z_m\times Z_n$ is isomorphic to a cyclic group of order $mn$, that is to $\Bbb Z_{mn}$. It remains to remark that if $A_m$ is a Sidon set in $\Bbb Z_m\times \Bbb Z_m$ and $A_n$ is a Sidon set in $\Bbb Z_n\times\Bbb Z_n$ then $A_m\times A_n$ is a Sidon set in $(\Bbb Z_m\times \Bbb Z_m)\times (\Bbb Z_n\times \Bbb Z_n)\simeq \Bbb Z_{mn}\times\Bbb Z_{mn}$.

Now we claim that the group $G=\Bbb Z_8\times \Bbb Z_8$ has no Sidon set $A$ of size eight. Indeed, suppose to the contrary that such a set $A$ exists. Let $H$ be a subgroup of $G$ consisting of elements with both coordinates even. We claim that there exist elements $a$ and $b$ of $A$ such that $a-b\in H+(1,1)$. Indeed, otherwise $A$ is contained in two cosets of $G/H$, and then $A-A$ is contained in three cosets of $G/H$, which follows that $57=|A-A|\le 48$, a contradiction. Put $A’=A-a$. Then $A$ contains an element $b-a=(c_1,c_2)$ with both coordinates odd. There exists natural odd numbers $d_1$ and $d_2$ such that both $d_1c_1$ and $d_2c_2$ equal $1$ modulo $8$. Then a map of $\Bbb Z_8\times \Bbb Z_8$, $(x_1,x_2)\mapsto (d_1x_1,d_2x_2)$ is an isomorphism of $G$, which maps the set $A’$ into a Sidon set $A’’$ containing $(0,0)$ and $(1,1)$. Let $G_2$ be a subgroup of $G$ consisting of elements of order two, that is $G_2=\{(0,0), (0,4), (4,0), (4,4)\}$. Then $x=-x$ for each $x\in G_2$. There are no distinct elements $a,b\in A’’$ such that $a-b\in G_2$, because otherwise $b-a=-(a-b)=a-b$, which contradicts that $A’’$ is a Sidon set. Therefore each of sixteen cosets of $G/G_2$ contains at most one element of $A’’$, and the elements of cosets $(0,0)+G_2$ and $(1,1)+G_2$ are already fixed. So it remains to check all choices of six among fourteen remaining cosests containing elements of $A’’$ and for each chosen coset four possibilities to choose an element for $A’’$. More subtle arguments can decrease a number of cases to check even more, but already these cases were checked by a short Pascal program below at my old computer in less than a half a minute. It found a Sidon set $\{(1,1), (2,0), (2,1),(0,5),(5,0),(4,2),(4,7)\}$ of size seven but no Sidon set of size eight.

program p3491165;
label
 0;
var
 a,b:array[0..7,0..1]of Byte;
   c:array[0..13,0..1]of Byte;
   d:array[0..7,0..7]of Boolean;
 i,j:Word;
 sum,k,l,d0,d1:Byte;
OFi:Text;
begin
c[0,0]:=0;c[0,1]:=1;
c[1,0]:=0;c[1,1]:=2;
c[2,0]:=0;c[2,1]:=3;
c[3,0]:=1;c[3,1]:=0;
c[4,0]:=1;c[4,1]:=2;
c[5,0]:=1;c[5,1]:=3;
c[6,0]:=2;c[6,1]:=0;
c[7,0]:=2;c[7,1]:=1;
c[8,0]:=2;c[8,1]:=2;
c[9,0]:=2;c[9,1]:=3;
c[10,0]:=3;c[10,1]:=0;
c[11,0]:=3;c[11,1]:=1;
c[12,0]:=3;c[12,1]:=2;
c[13,0]:=3;c[13,1]:=3;
assign(OFi,'3491165.txt');
rewrite(OFi);
b[7,0]:=0;b[7,1]:=0;
b[6,0]:=1;b[6,1]:=1;
for i:=0 to 16363 do begin
 sum:=0;
 for k:=0 to 13 do inc(sum, 1 and (i shr k));
 if sum<>6 then Continue;
 l:=0;
 for k:=0 to 13 do if (1 and (i shr k))=1 then begin
  a[l,0]:=c[k,0];
  a[l,1]:=c[k,1];
  inc(l);
 end;

 for j:=0 to 4095 do begin
  for k:=0 to 5 do begin
   b[k,0]:=a[k,0]+4*((j shr (2*k))and 1);
   b[k,1]:=a[k,1]+4*((j shr (2*k+1))and 1);
  end;
  FillChar(d,SizeOf(d),0);
  for k:=0 to 7 do for l:=0 to 7 do begin
   if k=l then Continue;
   d0:=(8+b[k,0]-b[l,0]) mod 8;
   d1:=(8+b[k,1]-b[l,1]) mod 8;
   if d[d0,d1] then goto 0 else d[d0,d1]:=True;
  end;
  for k:=0 to 7 do writeln(OFi,b[k,0],' ',b[k,1]);
0:
 end;

end;
close(OFi);
end.