

A177719


Number of line segments connecting exactly 3 points in an n x n grid of points


0



0, 0, 8, 24, 60, 112, 212, 344, 548, 800, 1196, 1672, 2284, 2992, 3988, 5128, 6556, 8160, 10180, 12424, 15068, 17968, 21604, 25576, 30092, 34976, 40900, 47288, 54500, 62224, 70972, 80296, 90740, 101824, 114700, 128344, 143212, 158896, 176836
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

a(n) is also the number of pairs of points visible to each other exactly through one point in an n x n grid of points.
Mathematica code below computes with j=1 also A114043(n)1 and A141255(n) much more efficiently than codes/formulas currently presented for those sequences.


LINKS

Table of n, a(n) for n=1..39.
S. Mustonen, On lines going through a given number of points in a rectangular grid of points


FORMULA

See Mathematica code.


MATHEMATICA

j=2;
a[n_]:=a[n]=If[n<=j, 0, 2*a1[n]a[n1]+R1[n]]
a1[n_]:=a1[n]=If[n<=j, 0, 2*a[n1]a1[n1]+R2[n]]
R1[n_]:=R1[n]=If[n<=j, 0, R1[n1]+4*S[n]]
R2[n_]:=(n1)*S[n]
S[n_]:=If[Mod[n1, j]==0, EulerPhi[(n1)/j], 0]
Table[a[n], {n, 1, 50}]


CROSSREFS

Sequence in context: A159741 A099041 A129959 * A049724 A060602 A066605
Adjacent sequences: A177716 A177717 A177718 * A177720 A177721 A177722


KEYWORD

nonn


AUTHOR

Seppo Mustonen, May 13 2010


STATUS

approved



