cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A190312 Number of scalene triangles on an n X n grid (or geoboard).

This page as a plain text file.
%I A190312 #28 Feb 16 2025 08:33:14
%S A190312 0,0,40,368,1704,5704,15400,36096,75632,145968,263592,451392,738360,
%T A190312 1163552,1774840,2632344,3808992,5394752,7493936,10233832,13759008,
%U A190312 18241312,23877984,30896984,39551456,50137240,62983128,78459880
%N A190312 Number of scalene triangles on an n X n grid (or geoboard).
%H A190312 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Geoboard.html">Geoboard</a>.
%H A190312 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/ScaleneTriangle.html">Scalene Triangle</a>.
%F A190312 a(n) = A045996(n) - A186434(n).
%t A190312 q[n_] :=
%t A190312   Module[{sqDist, t0, t1, t2},
%t A190312    (* Squared distances *)
%t A190312    sqDist = {p_, q_} :> (Floor[p/n] - Floor[q/n])^2 + (Mod[p, n] - Mod[q, n])^2;
%t A190312    (* Triads of points *)
%t A190312    t0 = Subsets[Range[0, n^2 - 1], {3, 3}];
%t A190312    (* Exclude collinear vertices *)
%t A190312    t1 = Select[t0, Det[Map[{Floor[#/n], Mod[#, n], 1} &, {#[[1]], #[[2]], #[[
%t A190312            3]]}]] != 0 &];
%t A190312    (* Calculate sides *)
%t A190312    t2 = Map[{#,
%t A190312     Sort[{{#[[2]], #[[3]]}, {#[[3]], #[[1]]}, {#[[1]], #[[2]]}} /. sqDist]}&, t1];
%t A190312    (* Select scalenes *)
%t A190312    t2 = Select[t2,
%t A190312       #[[2, 1]] != #[[2, 2]] && #[[2, 2]] != #[[2, 3]] && #[[2,3]] != #[[2, 1]] &];
%t A190312    Return[Length[t2]];
%t A190312    ];
%t A190312 Map[q[#] &, Range[9]] (* _César Eliud Lozada_, Mar 26 2021 *)
%Y A190312 Cf. A045996, A186434.
%K A190312 nonn
%O A190312 1,3
%A A190312 _Martin Renner_, May 08 2011