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 A018809 #21 Oct 30 2018 03:30:39 %S A018809 0,0,6,12,48,108,248,428,764,1196,1900,2668,3824,5244,7248,9380,12192, %T A018809 15372,19528,24020,29732,36052,43808,51836,61636,72492,85308,98492, %U A018809 114012,130668,150196,170828,194768,220276,249452,279284,312572,348036 %N A018809 Number of lines through exactly 2 points of an n X n grid of points. %H A018809 Seiichi Manyama, <a href="/A018809/b018809.txt">Table of n, a(n) for n = 0..1000</a> %H A018809 S. Mustonen, <a href="http://www.survo.fi/papers/PointsInGrid.pdf">On lines and their intersection points in a rectangular grid of points</a> [From _Seppo Mustonen_, Apr 18 2009] %F A018809 a(n) = (1/2) * (f(n, 3) - 2 f(n, 2) + f(n, 1)) where f(n, k) = Sum ((n - |kx|)(n - |ky|)); -n<kx<n, -n<ky<n, (x, y)=1. [_Seppo Mustonen_, Apr 18 2009] %t A018809 a[n_] := 1/2 (f[n, 3] - 2 f[n, 2] + f[n, 1]); %t A018809 f[n_, k_] := Sum[x = kx/k; y = ky/k; If[IntegerQ[x] && IntegerQ[y] && CoprimeQ[x, y], (n - Abs[kx])(n - Abs[ky]), 0], {kx, -n + 1, n - 1}, {ky, -n + 1, n - 1}]; %t A018809 Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Oct 30 2018 *) %K A018809 nonn %O A018809 0,3 %A A018809 _David W. Wilson_ %E A018809 An incorrect formula removed by _Seppo Mustonen_, Apr 25 2009