3 deleted 11 characters in body

Maybe it would be easier to count the number of lines in nxn which pass through more than two points.

That's equivalent to asking how many 2ix2j rectangles there are in nxn, where i and j are relatively prime, except that it would overcount the lines that pass through 3 or more points.

Let R_k = the number of ki x kj rectangles in nxn, where i and j are relatively prime.

The number of lines passing through at least three points in nxn is R_2 + R_3 - R_4 + R_3...

2 added 274 characters in body

Maybe it would be easier to count the number of lines in nxn which pass through more than two points.

That's equivalent to asking how many 2ix2j rectangles there are in nxn, where i and subtract j are relatively prime, except that number from n^2*(n^2-1)/2 it would overcount the lines that pass through 3 or more points.

Let R_k = the number of ways to choose two ki x kj rectangles in nxn, where i and j are relatively prime.

The number of lines passing through at least three points in the nxn rectangleis R_2 + R_3 - R_4 + ...

1

Maybe it would be easier to count the number of lines in nxn which pass through more than two points, and subtract that number from n^2*(n^2-1)/2 = number of ways to choose two points in the nxn rectangle.