[go: up one dir, main page]

login
A160846
Number of lines through at least 2 points of a 6 X n grid of points.
2
0, 1, 38, 75, 136, 207, 306, 405, 534, 673, 836, 1003, 1200, 1401, 1632, 1869, 2128, 2397, 2696, 2995, 3324, 3661, 4022, 4389, 4786, 5187, 5616, 6051, 6510, 6979, 7478, 7975, 8502, 9039, 9600, 10167, 10762, 11361, 11990, 12625, 13284, 13951, 14648
OFFSET
0,3
FORMULA
a(n) = (1/2)*(f(m,n,1)-f(m,n,2)) where f(m,n,k) = Sum((n-|kx|)*(m-|ky|)); -n < kx < n, -m < ky < m, (x,y)=1, m=6.
For another more efficient formula, see Mathematica code below.
Empirical g.f.: -x*(6*x^12 + 6*x^11 + 7*x^10 + 32*x^9 + 63*x^8 + 117*x^7 + 156*x^6 + 192*x^5 + 168*x^4 + 135*x^3 + 75*x^2 + 38*x + 1) / ((x - 1)^3*(x + 1)*(x^2 + 1)*(x^2 + x + 1)*(x^4 + x^3 + x^2 + x + 1)). - Colin Barker, May 24 2015
MATHEMATICA
m=6;
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, 42}]
CROSSREFS
Sequence in context: A032506 A044104 A044485 * A219999 A219997 A039421
KEYWORD
nonn
AUTHOR
Seppo Mustonen, May 28 2009
STATUS
approved