%I #23 May 28 2021 20:54:11
%S 0,0,3,18,57,137,280,517,863,1368,2069,3007,4218,5774,7704,10109,
%T 13025,16523,20671,25567,31274,37891,45529,54213,64082,75320,87901,
%U 102014,117736,135217,154606,176024,199502,225290,253485,284305,317811,354282,393618,436202,482332
%N Number of scalene triangles, distinct up to congruence, on an n X n grid (or geoboard).
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Geoboard.html">Geoboard</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ScaleneTriangle.html">Scalene Triangle</a>.
%F a(n) = A028419(n) - A189978(n).
%t q[n_] :=
%t Module[{sqDist, t0, t1, t2, t3},
%t (*Squared distances*)
%t sqDist = {p_,q_} :> (Floor[p/n] - Floor[q/n])^2 + (Mod[p, n] - Mod[q, n])^2;
%t (*Triads of points*)
%t t0 = Subsets[Range[0, n^2 - 1], {3, 3}];
%t (* Exclude collinear vertices *)
%t t1 = Select[t0,
%t Det[Map[{Floor[#/n], Mod[#, n], 1} &, {#[[1]], #[[2]], #[[
%t 3]]}]] != 0 &];
%t (*Calculate sides*)
%t t2 = Map[{#,
%t Sort[{{#[[2]], #[[3]]}, {#[[3]], #[[1]]}, {#[[1]], #[[2]]}} /.
%t sqDist]} &, t1];
%t (*Exclude not-scalenes*)
%t t2 = Select[
%t t2, #[[2, 1]] != #[[2, 2]] && #[[2, 2]] != #[[2, 3]] && #[[2,
%t 3]] != #[[2, 1]] &];
%t (* Find groups of congruent triangles *)
%t t3 = GatherBy[Range[Length[t2]], t2[[#, 2]] &];
%t Return[Length[t3]];
%t ];
%t Map[q[#] &, Range[10]] (* _César Eliud Lozada_, Mar 26 2021 *)
%Y Cf. A028419, A189978.
%K nonn
%O 1,3
%A _Martin Renner_, May 08 2011