%I #4 Mar 13 2020 20:27:50
%S 0,0,0,0,12,32,60,96,160,240,336,448,632,848,1096,1376,1760,2192,2672,
%T 3200,3952,4784,5696,6688,7864,9136,10504,11968,13888,15952,18160,
%U 20512,23280,26224,29344,32640,36568,40720,45096,49696,54856,60272,65944
%N Number of line segments connecting exactly 5 points in an n x n grid of points
%C a(n) is also the number of pairs of points visible to each other exactly through 3 points in an n x n grid of points.
%H S. Mustonen, <a href="http://www.survo.fi/papers/LinesInGrid2.pdf">On lines going through a given number of points in a rectangular grid of points</a>
%H Seppo Mustonen, <a href="/A141255/a141255.pdf">On lines going through a given number of points in a rectangular grid of points</a> [Local copy]
%F See Mathematica code.
%t j=4;
%t a[n_]:=a[n]=If[n<=j,0,2*a1[n]-a[n-1]+R1[n]]
%t a1[n_]:=a1[n]=If[n<=j,0,2*a[n-1]-a1[n-1]+R2[n]]
%t R1[n_]:=R1[n]=If[n<=j,0,R1[n-1]+4*S[n]]
%t R2[n_]:=(n-1)*S[n]
%t S[n_]:=If[Mod[n-1,j]==0,EulerPhi[(n-1)/j],0]
%t Table[a[n],{n,1,50}]
%K nonn
%O 1,5
%A _Seppo Mustonen_, May 13 2010
|