login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A018809 Number of lines through exactly 2 points of an n X n grid of points. 5
0, 0, 6, 12, 48, 108, 248, 428, 764, 1196, 1900, 2668, 3824, 5244, 7248, 9380, 12192, 15372, 19528, 24020, 29732, 36052, 43808, 51836, 61636, 72492, 85308, 98492, 114012, 130668, 150196, 170828, 194768, 220276, 249452, 279284, 312572, 348036 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
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]
MATHEMATICA
a[n_] := 1/2 (f[n, 3] - 2 f[n, 2] + f[n, 1]);
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}];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Oct 30 2018 *)
CROSSREFS
Sequence in context: A106692 A032470 A342302 * A226882 A214903 A256584
KEYWORD
nonn
AUTHOR
EXTENSIONS
An incorrect formula removed by Seppo Mustonen, Apr 25 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 07:38 EDT 2024. Contains 371782 sequences. (Running on oeis4.)