I created a triangle whose length of the medians are integral numbers. Please comment to me about my code.
> resrart:
ListTools[Categorize]:
N:=5:
L:=[]:
for x1 from -N to N do
for y1 from x1 to N do
for z1 from y1 to N do
for x2 from -N to N do
for y2 from -N to N do
for z2 from -N to N do
a:=sqrt(x1^2+y1^2+z1^2):
b:=sqrt(x2^2+y2^2+z2^2):
c:=sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2):
ma:=sqrt((b^2+c^2)/2-a^2/4):
mb:=sqrt((a^2+c^2)/2-b^2/4):
mc:=sqrt((a^2+b^2)/2-c^2/4):
if (y1*z2-z1*y2)^2+(z1*x2-x1*z2)^2+(x1*y2-y1*x2)^2<>0
and type(ma, integer) and type(mb, integer)and type(mc, integer)
then L:=[op(L), [[0, 0, 0], [x1, y1, z1], [x2, y2, z2],[ma,mb,mc]]]: fi:
od: od: od: od: od: od:
nops(L);
L;