A160848 Number of lines through at least 2 points of an 8 X n grid of points.
0, 1, 66, 131, 238, 361, 534, 709, 938, 1183, 1470, 1759, 2104, 2459, 2870, 3287, 3740, 4209, 4734, 5261, 5844, 6437, 7070, 7711, 8408, 9115, 9872, 10637, 11444, 12265, 13142, 14015, 14944, 15889, 16876, 17871, 18914, 19967, 21076, 22193, 23352
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
Crossrefs
Column k=8 of A295707.
Programs
-
Mathematica
m=8; a[0]=0; a[1]=1; a[2]=m^2+2; a[3]=2*m^2+3-Mod[m,2]; a[n_]:=a[n]=2*a[n-1]-a[n-2]+2*p1[m,n]+2*p4[m,n] p1[m_,n_]:=Sum[p2[m,n,y], {y,1,m-1}] p2[m_,n_,y_]:=If[GCD[y,n-1]==1,m-y,0] p[i_]:=If[i>0,i,0] p2[m_,n_,x_,y_]:=p2[m,n,x,y]=(n-x)*(m-y)-p[n-2*x]*p[m-2*y] p3[m_,n_,x_,y_]:=p2[m,n,x,y]-2*p2[m,n-1,x,y]+p2[m,n-2,x,y] p4[m_,n_]:=p4[m,n]=If[Mod[n,2]==0,0,p42[m,n]] p42[m_,n_]:=p42[m,n]=Sum[p43[m,n,y], {y,1,m-1}] p43[m_,n_,y_]:=If[GCD[(n-1)/2,y]==1,p3[m,n,(n-1)/2,y],0] Table[a[n],{n,0,40}]
Formula
a(n) = (1/2)*(f(m,n,1)-f(m,n,2)) where f(m,n,k)=Sum((n-|kx|)*(m-|ky|)); -n
For another more efficient formula, see Mathematica code below.
Conjectures from Colin Barker, Dec 25 2017: (Start)
G.f.: x*(1 + 66*x + 132*x^2 + 304*x^3 + 492*x^4 + 771*x^5 + 1003*x^6 + 1273*x^7 + 1390*x^8 + 1480*x^9 + 1374*x^10 + 1241*x^11 + 971*x^12 + 739*x^13 + 476*x^14 + 296*x^15 + 140*x^16 + 74*x^17 + 17*x^18 + 8*x^19 + 8*x^20) / ((1 - x)^3*(1 + x)*(1 - x + x^2)*(1 + x^2)*(1 + x + x^2)*(1 + x + x^2 + x^3 + x^4)*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6)).
a(n) = -a(n-2) + a(n-5) + a(n-6) + 2*a(n-7) + a(n-8) + a(n-9) - a(n-11) - a(n-12) - 2*a(n-13) - a(n-14) - a(n-15) + a(n-18) + a(n-20) for n>21.
(End)