%I #21 Sep 08 2022 08:45:45
%S 0,1,18,35,62,93,136,181,238,299,370,445,532,621,722,827,942,1061,
%T 1192,1325,1470,1619,1778,1941,2116,2293,2482,2675,2878,3085,3304,
%U 3525,3758,3995,4242,4493,4756,5021,5298,5579,5870,6165,6472,6781,7102,7427,7762
%N Number of lines through at least 2 points of a 4 X n grid of points.
%H Seiichi Manyama, <a href="/A160844/b160844.txt">Table of n, a(n) for n = 0..1000</a>
%H S. Mustonen, <a href="http://www.survo.fi/papers/PointsInGrid.pdf">On lines and their intersection points in a rectangular grid of points</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,0,-1,-1,1).
%F a(n) = 2*a(n-1) - a(n-2) + C(mod(n+2,6) + 1)), C=(10,4,12,2,12,4).
%F From _Colin Barker_, May 24 2015: (Start)
%F a(n) = a(n-1) + a(n-2) - a(n-4) - a(n-5) + a(n-6) for n > 5.
%F 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)).
%F (End)
%t 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}]
%t Join[{0,1}, LinearRecurrence[{1,1,0,-1,-1,1}, {18, 35, 62, 93, 136, 181}, 50]] (* _G. C. Greubel_, Apr 30 2018 *)
%o (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
%o (PARI) 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
%Y 4th row/column of A107348, A295707.
%K nonn
%O 0,3
%A _Seppo Mustonen_, May 28 2009