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.
%I A045996 #32 Oct 04 2022 21:21:37 %S A045996 0,4,76,516,2148,6768,17600,40120,82608,157252,280988,477012,775172, %T A045996 1214768,1844512,2725000,3930384,5550844,7692300,10482124,14066996, %U A045996 18619128,24337056,31449200,40212160,50921316,63907468,79542108 %N A045996 Number of triangles in an n X n grid (or geoplane). %C A045996 The triangles must have nonzero area -- their vertices must not be collinear. %C A045996 The degenerate (i.e., collinear) triangles are counted in A000938. The 1000-term b-file there could be used to produce a 1000-term b-file for the present sequence. - _N. J. A. Sloane_, Jun 19 2020 %H A045996 Vaclav Kotesovec, <a href="/A045996/b045996.txt">Table of n, a(n) for n = 1..1000</a> %H A045996 I. L. Canestro, <a href="http://www.math.niu.edu/~rusin/known-math/00_incoming/triangles_count">Checkerboard</a>, sci.math 22 Oct 2000 [broken link] %H A045996 I. L. Canestro, <a href="/A045996/a045996.txt">Checkerboard</a>, sci.math 22 Oct 2000 [Cached copy] %F A045996 a(n) = ((n-1)^2*n^2*(n+1)^2)/6 - 2*Sum_{m=2..n} Sum_{k=2..n} (n-k+1)*(n-m+1)*gcd(k-1, m-1). %F A045996 a(n) = binomial(n^2,3) - A000938(n). - _R. J. Mathar_, May 21 2010 %e A045996 a(2)=4 because 4 isosceles right triangles can be placed on a 2 X 2 grid. %t A045996 a[n_] := ((n - 1)^2*n^2*(n + 1)^2)/6 - 2*Sum[(n - k + 1)*(n - l + 1)*GCD[k - 1, l - 1], {k, 2, n}, {l, 2, n}]; Array[a, 28] (* _Robert G. Wilson v_, May 23 2010 *) %Y A045996 Cf. A000938. %K A045996 nice,nonn,easy %O A045996 1,2 %A A045996 _Ignacio Larrosa CaƱestro_