A160844 Number of lines through at least 2 points of a 4 X n grid of points.
0, 1, 18, 35, 62, 93, 136, 181, 238, 299, 370, 445, 532, 621, 722, 827, 942, 1061, 1192, 1325, 1470, 1619, 1778, 1941, 2116, 2293, 2482, 2675, 2878, 3085, 3304, 3525, 3758, 3995, 4242, 4493, 4756, 5021, 5298, 5579, 5870, 6165, 6472, 6781, 7102, 7427, 7762
Offset: 0
Keywords
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..1000
- S. Mustonen, On lines and their intersection points in a rectangular grid of points
- Index entries for linear recurrences with constant coefficients, signature (1,1,0,-1,-1,1).
Programs
-
Magma
I:=[18, 35, 62, 93, 136, 181]; [0,1] cat [n le 6 select I[n] else Self(n-1) +Self(n-2) -Self(n-4) -Self(n-5) +Self(n-6): n in [1..30]]; // G. C. Greubel, Apr 30 2018
-
Mathematica
a[0]=0; a[1]=1; a[2]=18; a[3]=35; a[n_]:=a[n]=a[n]=2*a[n-1]-a[n-2]+R[n] c4={10,4,12,2,12,4}; R[n_]:=c4[[Mod[n+2,6]+1]] Table[a[n],{n,0,46}] Join[{0,1}, LinearRecurrence[{1,1,0,-1,-1,1}, {18, 35, 62, 93, 136, 181}, 50]] (* G. C. Greubel, Apr 30 2018 *)
-
PARI
my(x='x+O('x^30)); concat([0], Vec(x*(4*x^6-3*x^4+9*x^3+16*x^2+ 17*x+1 )/((1-x)^3*(x+1)*(x^2+x+1)))) \\ G. C. Greubel, Apr 30 2018
Formula
a(n) = 2*a(n-1) - a(n-2) + C(mod(n+2,6) + 1), C=(10,4,12,2,12,4), for n >= 4.
From Colin Barker, May 24 2015: (Start)
a(n) = a(n-1) + a(n-2) - a(n-4) - a(n-5) + a(n-6) for n > 5.
G.f.: x*(4*x^6 - 3*x^4 + 9*x^3 + 16*x^2 + 17*x + 1) / ((1-x)^3*(x + 1)*(x^2 + x + 1)).
(End)