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.

A190313 Number of scalene triangles, distinct up to congruence, on an n X n grid (or geoboard).

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