login
Number of line segments connecting exactly 9 points in an n x n grid of points
0

%I #2 Mar 30 2012 18:59:35

%S 0,0,0,0,0,0,0,0,20,48,84,128,180,240,308,384,504,640,792,960,1144,

%T 1344,1560,1792,2144,2528,2944,3392,3872,4384,4928,5504,6248,7040,

%U 7880,8768,9704,10688,11720,12800,14264,15808,17432,19136,20920,22784,24728,26752

%N Number of line segments connecting exactly 9 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 7 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>

%F See Mathematica code.

%t j=8;

%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,9

%A _Seppo Mustonen_, May 13 2010