A332367
Consider a partition of the plane (a_1,a_2) in R X R by the lines a_1*x_1 + a_2*x_2 = 1 for 0 <= x_1 <= m-1, 1 <= x_2 <= 1-1. The cells are (generalized) triangles and quadrilaterals. Triangle read by rows: T(m,n) = number of triangular cells in the partition for m >= n >= 2.
Original entry on oeis.org
4, 8, 20, 12, 32, 52, 16, 48, 80, 124, 20, 64, 108, 168, 228, 24, 84, 144, 228, 312, 428, 28, 104, 180, 288, 396, 544, 692, 32, 128, 224, 360, 496, 684, 872, 1100, 36, 152, 268, 432, 596, 824, 1052, 1328, 1604, 40, 180, 320, 520, 720, 1000, 1280, 1620, 1960, 2396
Offset: 2
Triangle begins:
4,
8, 20,
12, 32, 52,
16, 48, 80, 124,
20, 64, 108, 168, 228,
24, 84, 144, 228, 312, 428,
28, 104, 180, 288, 396, 544, 692,
32, 128, 224, 360, 496, 684, 872, 1100,
36, 152, 268, 432, 596, 824, 1052, 1328, 1604,
...
-
# Maple code for sequences mentioned in Theorem 12 of Alekseyev et al. (2015).
VR := proc(m,n,q) local a,i,j; a:=0;
for i from -m+1 to m-1 do for j from -n+1 to n-1 do
if gcd(i,j)=q then a:=a+(m-abs(i))*(n-abs(j)); fi; od: od: a; end;
VS := proc(m,n) local a,i,j; a:=0; # A331781
for i from 1 to m-1 do for j from 1 to n-1 do
if gcd(i,j)=1 then a:=a+1; fi; od: od: a; end;
c3 := (m,n) -> VR(m,n,2)+4; # A332367
for m from 2 to 12 do lprint([seq(c3(m,n),n=2..m)]); od:
[seq(c3(n,n)/4,n=2..40)]; # A332368
c4 := (m,n) -> VR(m,n,1)/2 - VR(m,n,2) - 3; # A332369
for m from 2 to 12 do lprint([seq(c4(m,n),n=2..m)]); od:
[seq(c4(n,n),n=2..40)]; # A332370
ct := (m,n) -> c3(m,n)+c4(m,n); # A332371
for m from 2 to 12 do lprint([seq(ct(m,n),n=2..m)]); od:
[seq(ct(n,n),n=2..40)]; # A114043
et := (m,n) -> VR(m,n,1) - VR(m,n,2)/2 - VS(m,n) - 2; # A332372
for m from 2 to 12 do lprint([seq(et(m,n),n=2..m)]); od:
[seq(et(n,n),n=2..40)]; # A332373
vt := (m,n) -> et(m,n) - ct(m,n) +1; # A332374
for m from 2 to 12 do lprint([seq(vt(m,n),n=2..m)]); od:
[seq(vt(n,n),n=2..40)]; # A332375
A332371
Consider a partition of the plane (a_1,a_2) in R X R by the lines a_1*x_1 + a_2*x_2 = 1 for 0 <= x_1 <= m-1, 1 <= x_2 <= 1-1. The cells are (generalized) triangles and quadrilaterals. Triangle read by rows: T(m,n) = total number of cells in the partition for m >= n >= 2.
Original entry on oeis.org
7, 14, 29, 23, 50, 87, 34, 75, 132, 201, 47, 106, 189, 290, 419, 62, 141, 252, 387, 560, 749, 79, 182, 327, 504, 731, 980, 1283, 98, 227, 410, 633, 920, 1235, 1618, 2041, 119, 278, 503, 778, 1133, 1522, 1995, 2518, 3107, 142, 333, 604, 935, 1362, 1829, 2398, 3027, 3736, 4493
Offset: 2
Triangle begins:
7,
14, 29,
23, 50, 87,
34, 75, 132, 201,
47, 106, 189, 290, 419,
62, 141, 252, 387, 560, 749,
79, 182, 327, 504, 731, 980, 1283,
98, 227, 410, 633, 920, 1235, 1618, 2041,
119, 278, 503, 778, 1133, 1522, 1995, 2518, 3107,
...
A115009
Array read by antidiagonals: let V(m,n) = Sum_{i=1..m, j=1..n, gcd(i,j)=1} (m+1-i)*(n+1-j), then T(m,n) = 2*m*n+m+n+2*V(m,n), for m >= 0, n >= 0.
Original entry on oeis.org
0, 1, 1, 2, 6, 2, 3, 13, 13, 3, 4, 22, 28, 22, 4, 5, 33, 49, 49, 33, 5, 6, 46, 74, 86, 74, 46, 6, 7, 61, 105, 131, 131, 105, 61, 7, 8, 78, 140, 188, 200, 188, 140, 78, 8, 9, 97, 181, 251, 289, 289, 251, 181, 97, 9, 10, 118, 226, 326, 386, 418, 386, 326, 226, 118, 10, 11, 141, 277
Offset: 0
The array begins:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
1, 6, 13, 22, 33, 46, 61, 78, 97, 118, ...
2, 13, 28, 49, 74, 105, 140, 181, 226, 277, ...
3, 22, 49, 86, 131, 188, 251, 326, 409, 502, ...
4, 33, 74, 131, 200, 289, 386, 503, 632, 777, ...
5, 46, 105, 188, 289, 418, 559, 730, 919, 1132, ...
6, 61, 140, 251, 386, 559, 748, 979, 1234, 1521, ...
7, 78, 181, 326, 503, 730, 979, 1282, 1617, 1994, ...
...
- D. M. Acketa, J. D. Zunic: On the number of linear partitions of the (m,n)-grid. Inform. Process. Lett., 38 (3) (1991), 163-168. See Table A.1.
- Jovisa Zunic, Note on the number of two-dimensional threshold functions, SIAM J. Discrete Math. Vol. 25 (2011), No. 3, pp. 1266-1268. See Equation (1.2).
-
V:=proc(m,n) local t1,i,j; t1:=0; for i from 1 to m do for j from 1 to n do if gcd(i,j)=1 then t1:=t1+(m+1-i)*(n+1-j); fi; od; od; t1; end; T:=(m,n)->(2*m*n+m+n+2*V(m,n));
-
V[m_, n_] := Sum[If[GCD[i, j] == 1, (m-i+1)*(n-j+1), 0], {i, 1, m}, {j, 1, n}]; T[m_, n_] := 2*m*n+m+n+2*V[m, n]; Table[T[m-n, n], {m, 0, 11}, {n, 0, m}] // Flatten (* Jean-François Alcover, Jan 08 2014 *)
A177719
Number of line segments connecting exactly 3 points in an n X n grid of points.
Original entry on oeis.org
0, 0, 8, 24, 60, 112, 212, 344, 548, 800, 1196, 1672, 2284, 2992, 3988, 5128, 6556, 8160, 10180, 12424, 15068, 17968, 21604, 25576, 30092, 34976, 40900, 47288, 54500, 62224, 70972, 80296, 90740, 101824, 114700, 128344, 143212, 158896, 176836
Offset: 1
-
j=2;
a[n_]:=a[n]=If[n<=j,0,2*a1[n]-a[n-1]+R1[n]]
a1[n_]:=a1[n]=If[n<=j,0,2*a[n-1]-a1[n-1]+R2[n]]
R1[n_]:=R1[n]=If[n<=j,0,R1[n-1]+4*S[n]]
R2[n_]:=(n-1)*S[n]
S[n_]:=If[Mod[n-1,j]==0,EulerPhi[(n-1)/j],0]
Table[a[n],{n,1,50}]
-
{ A177719(n) = if(n<2, return(0)); 2*(n*(n-2) + sum(i=1,n-1,sum(j=1,n-1, (gcd(i,j)==2)*(n-i)*(n-j))) ); } \\ Max Alekseyev, Jul 08 2019
-
from sympy import totient
def A177719(n): return 4*((n-1)*(n-2) + sum(totient(i)*(n-2*i)*(n-i) for i in range(2,n//2+1))) # Chai Wah Wu, Aug 18 2021
A331771
a(n) = Sum_{-n
Original entry on oeis.org
0, 12, 56, 172, 400, 836, 1496, 2564, 4080, 6212, 8984, 12788, 17488, 23644, 31112, 40148, 50912, 64172, 79448, 97868, 118912, 143108, 170504, 202500, 238080, 278700, 323864, 374508, 430272, 493380, 561832, 638692, 722656, 814604, 914360, 1023428
Offset: 1
- Koplowitz, Jack, Michael Lindenbaum, and A. Bruckstein. "The number of digital straight lines on an N* N grid." IEEE Transactions on Information Theory 36.1 (1990): 192-197. (See I(n).)
When divided by 4 this becomes
A115005, so this is a ninth sequence to add to the following list.
The following eight sequences are all essentially the same. The simplest is
A115004(n), which we denote by z(n). Then
A088658(n) = 4*z(n-1);
A114043(n) = 2*z(n-1)+2*n^2-2*n+1;
A114146(n) = 2*
A114043(n);
A115005(n) = z(n-1)+n*(n-1);
A141255(n) = 2*z(n-1)+2*n*(n-1);
A290131(n) = z(n-1)+(n-1)^2;
A306302(n) = z(n)+n^2+2*n.
-
VR := proc(m,n,q) local a,i,j; a:=0;
for i from -m+1 to m-1 do for j from -n+1 to n-1 do
if gcd(i,j)=q then a:=a+(m-abs(i))*(n-abs(j)); fi; od: od: a; end;
[seq(VR(n,n,1),n=1..50)];
-
a[n_] := Sum[Boole[GCD[i, j] == 1] (n - Abs[i]) (n - Abs[j]), {i, -n + 1, n - 1}, {j, -n + 1, n - 1}];
Array[a, 36] (* Jean-François Alcover, Apr 19 2020 *)
-
from sympy import totient
def A331771(n): return 4*((n-1)*(2*n-1)+sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n))) # Chai Wah Wu, Aug 17 2021
A332351
Triangle read by rows: T(m,n) = Sum_{-m= n >= 1.
Original entry on oeis.org
0, 1, 6, 2, 13, 28, 3, 22, 49, 86, 4, 33, 74, 131, 200, 5, 46, 105, 188, 289, 418, 6, 61, 140, 251, 386, 559, 748, 7, 78, 181, 326, 503, 730, 979, 1282, 8, 97, 226, 409, 632, 919, 1234, 1617, 2040, 9, 118, 277, 502, 777, 1132, 1521, 1994, 2517, 3106, 10, 141, 332, 603, 934, 1361, 1828, 2397, 3026, 3735, 4492
Offset: 1
Triangle begins:
0,
1, 6,
2, 13, 28,
3, 22, 49, 86,
4, 33, 74, 131, 200,
5, 46, 105, 188, 289, 418,
6, 61, 140, 251, 386, 559, 748,
7, 78, 181, 326, 503, 730, 979, 1282,
8, 97, 226, 409, 632, 919, 1234, 1617, 2040,
9, 118, 277, 502, 777, 1132, 1521, 1994, 2517, 3106,
...
- Jovisa Zunic, Note on the number of two-dimensional threshold functions, SIAM J. Discrete Math. Vol. 25 (2011), No. 3, pp. 1266-1268. See Equation (1.2).
This is the lower triangle of the array in
A115009.
-
VR := proc(m,n,q) local a,i,j; a:=0;
for i from -m+1 to m-1 do for j from -n+1 to n-1 do
if gcd(i,j)=q then a:=a+(m-abs(i))*(n-abs(j)); fi; od: od: a; end;
for m from 1 to 12 do lprint(seq(VR(m,n,1)/2,n=1..m),); od:
-
A332351[m_,n_]:=Sum[If[CoprimeQ[i,j],2(m-i)(n-j),0],{i,m-1},{j,n-1}]+2m*n-m-n;Table[A332351[m,n],{m,15},{n,m}] (* Paolo Xausa, Oct 18 2023 *)
A114531
Number of intersections of a convex set with the n X n grid.
Original entry on oeis.org
1, 2, 16, 214, 2856, 33367, 349895, 3302046, 28597720, 229893484, 1730841042, 12296287989, 82945782429, 533994100001, 3295058878301, 19560004053448, 112049953456910, 621112646095769, 3339451666010949, 17451533356424837, 88807504851447189, 440798078343276894
Offset: 0
a(3) = 214 (X's indicate points in intersection):
... X.. .X. ... XX. X.. X.. X.. XXX XX. XX. XX. X.. X.. .X. .X.
... ... ... .X. ... .X. ..X ... ... X.. .X. ..X .XX .X. .X. XX.
... ... ... ... ... ... ... .X. ... ... ... ... ... ..X .X. ...
-1- -4- -4- -1- -8- -4- -8- -8- -4- -4- -8- -8- -8- -2- -2- -4-
XXX XXX XX. XX. XX. XX. .X. X.. XXX XXX XX. XX. XX. XX. .X. XX.
X.. .X. XX. .X. .XX .X. XXX .XX XX. .X. .XX .XX XXX XX. XXX .X.
... ... ... .X. ... ..X ... .X. ... .X. ..X .X. ... ..X .X. .XX
-8- -4- -4- -8- -8- -8- -4- -4- -8- -4- -4- -8- -8- -4- -1- -4-
XXX XXX XXX XX. XX. XXX XXX XX. XXX XXX
XXX XX. XX. XXX XXX XXX XXX XXX XXX XXX
... X.. .X. .X. ..X X.. .X. .XX XX. XXX
-4- -4- -8- -4- -8- -8- -4- -2- -4- -1-
A332612
a(n) = Sum_{ i=2..n-1, j=1..i-1, gcd(i,j)=1 } (n-i)*(n-j).
Original entry on oeis.org
0, 0, 2, 11, 32, 77, 148, 268, 442, 691, 1018, 1472, 2036, 2780, 3686, 4786, 6100, 7724, 9598, 11863, 14454, 17437, 20818, 24772, 29172, 34200, 39794, 46071, 52986, 60817, 69314, 78860, 89292, 100720, 113122, 126686, 141244, 157294, 174566, 193228, 213172, 234954, 258058, 283189, 309946, 338473, 368782, 401516, 436040
Offset: 1
The following eight sequences are all essentially the same. The simplest is
A115004(n), which we denote by z(n). Then
A088658(n) = 4*z(n-1);
A114043(n) = 2*z(n-1)+2*n^2-2*n+1;
A114146(n) = 2*
A114043(n);
A115005(n) = z(n-1)+n*(n-1);
A141255(n) = 2*z(n-1)+2*n*(n-1);
A290131(n) = z(n-1)+(n-1)^2;
A306302(n) = z(n)+n^2+2*n. The present sequence and
A331771 could be added to this list.
-
I1 := proc(n) local a, i, j; a:=0;
for i from 2 to n-1 do for j from 1 to i-1 do
if igcd(i,j)=1 then a := a+(n-i)*(n-j); fi; od; od; a; end;
[seq(I1(n),n=1..40)];
-
a(n) = sum(i=2, n-1, sum(j=1, i-1, if (gcd(i,j)==1, (n-i)*(n-j)))); \\ Michel Marcus, Mar 14 2020
-
from sympy import totient
def A332612(n): return sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n))//2 # Chai Wah Wu, Aug 17 2021
A355902
Start with a 2 X n array of squares, join every vertex on top edge to every vertex on bottom edge; a(n) = one-half the number of cells.
Original entry on oeis.org
0, 3, 10, 26, 56, 112, 196, 331, 522, 790, 1138, 1615, 2204, 2975, 3910, 5041, 6388, 8047, 9958, 12262, 14894, 17920, 21346, 25347, 29796, 34875, 40522, 46854, 53826, 61716, 70274, 79883, 90380, 101875, 114346, 127981, 142612, 158737, 176086, 194827, 214852, 236717, 259906, 285124, 311970, 340588, 370990, 403819, 438440, 475556
Offset: 0
A115010
Array read by antidiagonals: let V(m,n) = Sum_{i=1..m, j=1..n, gcd(i,j)=1} (m+1-i)*(n+1-j), then T(m,n) = 2*m*n+m+n+2*V(m,n), for m >= 1, n >= 1.
Original entry on oeis.org
6, 13, 13, 22, 28, 22, 33, 49, 49, 33, 46, 74, 86, 74, 46, 61, 105, 131, 131, 105, 61, 78, 140, 188, 200, 188, 140, 78, 97, 181, 251, 289, 289, 251, 181, 97, 118, 226, 326, 386, 418, 386, 326, 226, 118, 141, 277, 409, 503, 559, 559, 503, 409, 277, 141, 166, 332, 502, 632, 730
Offset: 1
-
V:=proc(m,n) local t1,i,j; t1:=0; for i from 1 to m do for j from 1 to n do if gcd(i,j)=1 then t1:=t1+(m+1-i)*(n+1-j); fi; od; od; t1; end; T:=(m,n)->(2*m*n+m+n+2*V(m,n));
-
V[m_, n_] := Sum[Boole[CoprimeQ[i, j]]*(m-i+1)*(n-j+1), {i, m}, {j, n}];
T[m_, n_] := 2*m*n + m + n + 2*V[m, n];
Table[T[m - n + 1, n], {m, 1, 12}, {n, 1, m}] // Flatten (* Jean-François Alcover, Nov 28 2017 *)
Comments