|
MATHEMATICA
|
an={};
he[a_, b_, e_]:=1/(2 e) Sqrt[-(a-b-e) (a+b-e) (a-b+e) (a+b+e)];
paX[e_]:={e, 0} (*vertex A coordinate*)
pbX[a_, b_, e_]:={(-a^2+b^2+e^2)/(2 e), he[a, b, e]}(*vertex B coordinate*)
pc={0, 0}; (*vertex C coordinate*)
pdX[c_, d_, e_]:={(c^2-d^2+e^2)/(2 e), -he[c, d, e]}(*vertex D coordinate*)
convexQ[{bx_, by_}, {dx_, dy_}, e_]:=If[(by-dy) e>by dx-bx dy>0, True, False]
(*define order on tuples*)
gQ[x_, y_]:=Module[{z=x-y, res=False}, Do[If[z[[i]]>0, res=True; Break[], If[z[[i]]<0, Break[]]], {i, 1, 6}]; res]
(*check if tuple is canonical*)
canonicalQ[{a_, b_, c_, d_, e_, f_}]:=Module[{x={a, b, c, d, e, f}}, If[(gQ[{b, a, d, c, e, f}, x]||gQ[{d, c, b, a, e, f}, x]||gQ[{c, d, a, b, e, f}, x]||gQ[{b, c, d, a, f, e}, x]||gQ[{a, d, c, b, f, e}, x]||gQ[{c, b, a, d, f, e}, x]||gQ[{d, a, b, c, f, e}, x]), False, True]]
Do[cnt=0;
Do[pa=paX[e]; pb=pbX[a, b, e]; pd=pdX[c, d, e];
If[(f=Sqrt[(pb-pd).(pb-pd)]; IntegerQ[f])&&convexQ[pb, pd, e]&&canonicalQ[{a, b, c, d, e, f}], cnt++
(*; Print[{{a, b, c, d, e, f}, Graphics[Line[{pa, pb, pc, pd, pa}]]}]*)],
{b, 1, a}, {e, a-b+1, a+b-1}, {c, 1, a}, {d, Abs[e-c]+1, Min[a, e+c-1]}];
AppendTo[an, cnt], {a, 1 , 60}
]
an
|