OFFSET
0,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..1000 (terms 0..100 from T. D. Noe)
M. A. Alekseyev, M. Basova, N. Yu. Zolotykh. On the minimal teaching sets of two-dimensional threshold functions. SIAM J. Disc. Math. 29(1), 2015, pp. 157-165.
A.-M. Ernvall-Hytonen, K. Matomaki, P. Haukkanen, J. K. Merikoski, Formulas for the number of gridlines, Monatsh. f. Mathem. 164 (2) (2011) 157-170
P. Haukkanen, J. K. Merikoski, Some formulas for numbers of line segments and lines in a rectangular grid, arXiv:1108.1041 [math.CO], 2011.
Seppo Mustonen, On lines and their intersection points in a rectangular grid of points [Local copy]
FORMULA
(1/2) * (f(n, 1) - f(n, 2)) where f(n, k) = Sum ((n - |x|)(n - |y|)); -n < x < n, -n < y < n, (x, y)=k.
(1/2) * (f(n, 1) - f(n, 2)) where f(n, k) = Sum ((n - |kx|)(n - |ky|)); -n < kx < n, -n < ky < n, (x, y)=1. - Seppo Mustonen, Apr 18 2009
a(0) = L(0,1) = R1(0) = 0, a(n) = L(n,n) = 2L(n-1,n) - L(n-1,n-1) + R1(n), L(n-1,n) = 2L(n-1,n-1) - L(n-2,n-1) + R2(n), R1(n) = R1(n-1) + 4(phi(n-1) - e(n)), e(n)=0, n even, e(n) = phi((n-1)/2), n odd, R2(n) = (n-1)phi(n-1), n even, R2(n)=(n-1)phi(n-1)/2, n=1 mod 4, R2(n)=0, n=3 mod 4. - Seppo Mustonen, Apr 25 2009
a(n) = 2 * A331780(n). - Alois P. Heinz, Jun 05 2023
MATHEMATICA
L[0]=0; L1[1]=0; R1[1]=0;
L[n_]:=L[n]=2*L1[n]-L[n-1]+R1[n]
L1[n_]:=L1[n]=2*L[n-1]-L1[n-1]+R2[n]
R1[n_]:=R1[n]=R1[n-1]+4*(EulerPhi[n-1]-e[n])
e[n_]:=If[Mod[n, 2]==0, 0, EulerPhi[(n-1)/2]]
R2[n_]:= If[Mod[n, 2]==0, (n-1)*EulerPhi[n-1], If[Mod[n, 4]==1, (n-1)*EulerPhi[n-1]/2, 0]]
Table[L[n], {n, 0, 37}] (* Seppo Mustonen, Apr 25 2009 *)
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
STATUS
approved