A115004
a(n) = Sum_{i=1..n, j=1..n, gcd(i,j)=1} (n+1-i)*(n+1-j).
Original entry on oeis.org
1, 8, 31, 80, 179, 332, 585, 948, 1463, 2136, 3065, 4216, 5729, 7568, 9797, 12456, 15737, 19520, 24087, 29308, 35315, 42120, 50073, 58920, 69025, 80264, 92871, 106756, 122475, 139528, 158681, 179608, 202529, 227400, 254597, 283784, 315957, 350576, 387977
Offset: 1
- Ray Chandler, Table of n, a(n) for n = 1..1000
- M. Griffiths, Counting the regions in a regular drawing of K_{n,n}, J. Int. Seq. 13 (2010) # 10.8.5.
- S. Legendre, The Number of Crossings in a Regular Drawing of the Complete Bipartite Graph, JIS 12 (2009) 09.5.5.
- R. J. Mathar, Graphical representation among sequences closely related to this one (cf. N. J. A. Sloane, "Families of Essentially Identical Sequences").
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021. (Includes this sequence)
- N. J. A. Sloane (in collaboration with Scott R. Shannon), Art and Sequences, Slides of guest lecture in Math 640, Rutgers Univ., Feb 8, 2020. Mentions this sequence.
-
A115004 := proc(n)
local a,b,r ;
r := 0 ;
for a from 1 to n do
for b from 1 to n do
if igcd(a,b) = 1 then
r := r+(n+1-a)*(n+1-b);
end if;
end do:
end do:
r ;
end proc:
seq(A115004(n),n=1..30); # R. J. Mathar, Jul 20 2017
-
a[n_] := Sum[(n-i+1) (n-j+1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
Array[a, 40] (* Jean-François Alcover, Mar 23 2020 *)
-
a(n) = n^2 + sum(i=2, n, (n+1-i)*(2*n+2-i)*eulerphi(i)); \\ Michel Marcus, May 08 2024
-
from math import gcd
def a115004(n):
r=0
for a in range(1, n + 1):
for b in range(1, n + 1):
if gcd(a, b)==1:
r+=(n + 1 - a)*(n + 1 - b)
return r
print([a115004(n) for n in range(1, 51)]) # Indranil Ghosh, Jul 21 2017
-
from sympy import totient
def A115004(n): return n**2 + sum(totient(i)*(n+1-i)*(2*n+2-i) for i in range(2,n+1)) # Chai Wah Wu, Aug 15 2021
A306302
Number of regions into which a figure made up of a row of n adjacent congruent rectangles is divided upon drawing diagonals of all possible rectangles (a(0)=0 by convention).
Original entry on oeis.org
0, 4, 16, 46, 104, 214, 380, 648, 1028, 1562, 2256, 3208, 4384, 5924, 7792, 10052, 12744, 16060, 19880, 24486, 29748, 35798, 42648, 50648, 59544, 69700, 80992, 93654, 107596, 123374, 140488, 159704, 180696, 203684, 228624, 255892, 285152, 317400, 352096, 389576
Offset: 0
- Jinyuan Wang, Table of n, a(n) for n = 0..1000
- Max Alekseyev, Illustration for n = 3.
- M. A. Alekseyev. On the number of two-dimensional threshold functions, arXiv:math/0602511 [math.CO], 2006-2010; doi:10.1137/090750184, SIAM J. Disc. Math. 24(4), 2010, pp. 1617-1631.
- M. A. Alekseyev, M. Basova, and N. Yu. Zolotykh. On the minimal teaching sets of two-dimensional threshold functions, SIAM Journal on Discrete Mathematics 29:1 (2015), 157-165. doi:10.1137/140978090.
- Lars Blomberg, Scott R. Shannon and N. J. A. Sloane, Graphical Enumeration and Stained Glass Windows, 1: Rectangular Grids, (2020). Also arXiv:2009.07918.
- M. Griffiths, Counting the regions in a regular drawing of K_{n,n}, J. Int. Seq. 13 (2010) # 10.8.5, Lemma 2.
- Robert Israel, Maple program, Feb 07 2019
- S. Legendre, The Number of Crossings in a Regular Drawing of the Complete Bipartite Graph, J. Integer Seqs., Vol. 12, 2009.
- Scott R. Shannon, Colored illustration for T(1,1)
- Scott R. Shannon, Colored illustration for T(2,1)
- Scott R. Shannon, Colored illustration for T(3,1)
- Scott R. Shannon, Colored illustration for T(4,1)
- Scott R. Shannon, Colored illustration for T(5,1)
- Scott R. Shannon, Colored illustration for T(6,1)
- Scott R. Shannon, Colored illustration for T(7,1)
- Scott R. Shannon, Colored illustration for T(8,1)
- Scott R. Shannon, Colored illustration for T(9,1)
- Scott R. Shannon, Colored illustration for T(10,1)
- Scott R. Shannon, Colored illustration for T(11,1)
- Scott R. Shannon, Colored illustration for T(12,1)
- Scott R. Shannon, Colored illustration for T(13,1)
- Scott R. Shannon, Colored illustration for T(14,1)
- Scott R. Shannon, Colored illustration for T(15,1)
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
- Index entries for sequences related to stained glass windows
See
A331755 for the number of vertices,
A331757 for the number of edges.
-
# Maple from N. J. A. Sloane, Mar 04 2020, starting at n=1: First define z(n) = A115004
z := proc(n)
local a, b, r ;
r := 0 ;
for a from 1 to n do
for b from 1 to n do
if igcd(a, b) = 1 then
r := r+(n+1-a)*(n+1-b);
end if;
end do:
end do:
r ;
end proc:
a := n-> z(n)+n^2+2*n;
[seq(a(n), n=1..50)];
-
z[n_] := Sum[(n - i + 1)(n - j + 1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
a[0] = 0;
a[n_] := z[n] + n^2 + 2n;
a /@ Range[0, 40] (* Jean-François Alcover, Mar 24 2020 *)
-
from sympy import totient
def A306302(n): return 2*n*(n+1) + sum(totient(i)*(n+1-i)*(2*n+2-i) for i in range(2,n+1)) # Chai Wah Wu, Aug 16 2021
A290131
Number of regions in a regular drawing of the complete bipartite graph K_{n,n}.
Original entry on oeis.org
0, 2, 12, 40, 96, 204, 368, 634, 1012, 1544, 2236, 3186, 4360, 5898, 7764, 10022, 12712, 16026, 19844, 24448, 29708, 35756, 42604, 50602, 59496, 69650, 80940, 93600, 107540, 123316, 140428, 159642, 180632, 203618, 228556, 255822, 285080, 317326, 352020, 389498
Offset: 1
- Chai Wah Wu, Table of n, a(n) for n = 1..10000
- Martin Griffiths, Counting the regions in a regular drawing of K_{n,n}, J. Int. Seq. 13 (2010) # 10.8.5. See Lemma 2 and Table 1.
- Stéphane Legendre, The Number of Crossings in a Regular Drawing of the Complete Bipartite Graph, J. Integer Seqs., Vol. 12, 2009.
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
- Eric Weisstein's World of Mathematics, Complete Bipartite Graph
-
A290131 := proc(n)
A115004(n-1)+(n-1)^2 ;
end proc:
seq(A290131(n),n=1..30) ;
-
z[n_] := Sum[(n - i + 1)(n - j + 1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
a[n_] := z[n - 1] + (n - 1)^2;
Array[a, 40] (* Jean-François Alcover, Mar 24 2020 *)
-
from math import gcd
def a115004(n):
r=0
for a in range(1, n + 1):
for b in range(1, n + 1):
if gcd(a, b)==1:r+=(n + 1 - a)*(n + 1 - b)
return r
def a(n): return a115004(n - 1) + (n - 1)**2
print([a(n) for n in range(1, 51)]) # Indranil Ghosh, Jul 20 2017, after Maple code
-
from sympy import totient
def A290131(n): return 2*(n-1)**2 + sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n)) # Chai Wah Wu, Aug 16 2021
A114043
Take an n X n square grid of points in the plane; a(n) = number of ways to divide the points into two sets using a straight line.
Original entry on oeis.org
1, 7, 29, 87, 201, 419, 749, 1283, 2041, 3107, 4493, 6395, 8745, 11823, 15557, 20075, 25457, 32087, 39725, 48935, 59457, 71555, 85253, 101251, 119041, 139351, 161933, 187255, 215137, 246691, 280917, 319347, 361329, 407303
Offset: 1
Examples: the two sets are indicated by X's and o's.
a(2) = 7:
XX oX Xo XX XX oo oX
XX XX XX Xo oX XX oX
--------------------
a(3) = 29:
XXX oXX ooX ooo ooX ooo
XXX XXX XXX XXX oXX oXX
XXX XXX XXX XXX XXX XXX
-1- -4- -8- -4- -4- -8- Total = 29
--------------------
a(4)= 87:
XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX XXXX XXXo XXXo XXXo XXoo XXoo
XXXX XXXo XXoo Xooo oooo XXoo Xooo oooo Xooo oooo
--1- --4- --8- --8- --4- --4- --8- --8- --8- --8-
XXXX XXXX XXXX XXXX XXXX
XXXo XXXX XXXX XXXo XXXo
XXoo Xooo oooo Xooo XXoo
Xooo oooo oooo oooo oooo
--4- --8- --2- --4- --8- Total = 87.
--------------------
- T. D. Noe, Table of n, a(n) for n = 1..1000
- Max A. Alekseyev. On the number of two-dimensional threshold functions, arXiv:math/0602511 [math.CO], 2006-2010; doi:10.1137/090750184, SIAM J. Disc. Math. 24(4), 2010, pp. 1617-1631.
- M. A. Alekseyev, M. Basova, and N. Yu. Zolotykh. On the minimal teaching sets of two-dimensional threshold functions. SIAM Journal on Discrete Mathematics 29:1 (2015), 157-165. doi:10.1137/140978090. See Eq. (11).
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
-
a[n_] := 2*Sum[(n - i)*(n - j)*Boole[CoprimeQ[i, j]], {i, 1, n - 1}, {j, 1, n - 1}] + 2*n^2 - 2*n + 1; Array[a, 40] (* Jean-François Alcover, Apr 25 2016, after Max Alekseyev *)
-
from sympy import totient
def A114043(n): return 4*n**2-6*n+3 + 2*sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n)) # Chai Wah Wu, Aug 15 2021
Original entry on oeis.org
0, 3, 14, 43, 100, 209, 374, 641, 1020, 1553, 2246, 3197, 4372, 5911, 7778, 10037, 12728, 16043, 19862, 24467, 29728, 35777, 42626, 50625, 59520, 69675, 80966, 93627, 107568, 123345, 140458, 159673, 180664, 203651, 228590, 255857, 285116, 317363, 352058
Offset: 1
-
a[n_]:=2 Sum[(n-i) (n-j) Boole[CoprimeQ[i,j]], {i, 1, n-1}, {j, 1, n-1}] / 2 + n^2 - n; Array[a, 40] (* Vincenzo Librandi, Feb 05 2020 *)
-
from sympy import totient
def A115005(n): return (n-1)*(2*n-1) + sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n)) # Chai Wah Wu, Aug 15 2021
A088658
Number of triangles in an n X n unit grid that have minimal possible area (of 1/2).
Original entry on oeis.org
0, 4, 32, 124, 320, 716, 1328, 2340, 3792, 5852, 8544, 12260, 16864, 22916, 30272, 39188, 49824, 62948, 78080, 96348, 117232, 141260, 168480, 200292, 235680, 276100, 321056, 371484, 427024, 489900, 558112, 634724, 718432, 810116, 909600, 1018388, 1135136, 1263828, 1402304, 1551908
Offset: 1
Yuval Dekel (dekelyuval(AT)hotmail.com), Nov 21 2003
a(2)=4 because 4 (isosceles right) triangles with area 1/2 can be placed on a 2 X 2 grid.
-
z[n_] := Sum[(n - i + 1)(n - j + 1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
a[n_] := 4 z[n - 1];
Array[a, 40] (* Jean-François Alcover, Mar 24 2020 *)
-
from sympy import totient
def A088658(n): return 4*(n-1)**2 + 4*sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n)) # Chai Wah Wu, Aug 15 2021
A114146
Number of threshold functions on n X n grid.
Original entry on oeis.org
1, 2, 14, 58, 174, 402, 838, 1498, 2566, 4082, 6214, 8986, 12790, 17490, 23646, 31114, 40150, 50914, 64174, 79450, 97870, 118914, 143110, 170506, 202502, 238082, 278702, 323866, 374510, 430274, 493382, 561834, 638694, 722658, 814606, 914362, 1023430, 1140466
Offset: 0
- Chai Wah Wu, Table of n, a(n) for n = 0..10000
- M. A. Alekseyev. On the number of two-dimensional threshold functions, arXiv:math/0602511 [math.CO], 2006-2010; doi:10.1137/090750184, SIAM J. Disc. Math. 24(4), 2010, pp. 1617-1631.
- 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.
- Jack Koplowitz, 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 D(n).
- N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
-
a[0] = 1; a[n_] := 4 Sum[(n-i)(n-j) Boole[CoprimeQ[i, j]], {i, 1, n-1}, {j, 1, n-1}] + 4 n^2 - 4 n + 2;
Array[a, 38, 0] (* Jean-François Alcover, Sep 04 2018, after Max Alekseyev in A114043 *)
-
from sympy import totient
def A114146(n): return 1 if n == 0 else 8*n**2-12*n+6 + 4*sum(totient(i)*(n-i)*(2*n-i) for i in range(2,n)) # Chai Wah Wu, Aug 15 2021
A333282
Triangle read by rows: T(m,n) (m >= n >= 1) = number of regions formed by drawing the line segments connecting any two of the (m+1) X (n+1) lattice points in an m X n grid of squares and extending them to the boundary of the grid.
Original entry on oeis.org
4, 16, 56, 46, 192, 624, 104, 428, 1416, 3288, 214, 942, 3178, 7520, 16912, 380, 1672, 5612, 13188, 29588, 51864, 648, 2940, 9926, 23368, 52368, 92518, 164692, 1028, 4624, 15732, 37184, 83628, 148292, 263910, 422792, 1562, 7160, 24310, 57590, 130034, 230856, 410402, 658080, 1023416
Offset: 1
Triangle begins:
4,
16, 56,
46, 192, 624,
104, 428, 1416, 3288,
214, 942, 3178, 7520, 16912,
380, 1672, 5612, 13188, 29588, 51864,
648, 2940, 9926, 23368, 52368, 92518, 164692,
1028, 4624, 15732, 37184, 83628, 148292, 263910, 422792
1562, 7160, 24310, 57590, 130034, 230856, 410402, 658080, 1023416
2256, 10336, 35132, 83116, 187376, 331484, 588618, 942808, 1466056, 2101272
- Lars Blomberg, Scott R. Shannon, and N. J. A. Sloane, Graphical Enumeration and Stained Glass Windows, 1: Rectangular Grids, (2020). Also arXiv:2009.07918.
- Seppo Mustonen, Statistical accuracy of geometric constructions, 2008.
- Seppo Mustonen, Statistical accuracy of geometric constructions, 2008 [Local copy]
- Seppo Mustonen, On lines and their intersection points in a rectangular grid of points, 2009
- Seppo Mustonen, On lines and their intersection points in a rectangular grid of points, 2009 [Local copy]
- Seppo Mustonen, On lines going through a given number of points in a rectangular grid of points, 2010
- Seppo Mustonen, On lines going through a given number of points in a rectangular grid of points, 2010 [Local copy]
- Scott R. Shannon, Colored illustration for T(3,2)
- Scott R. Shannon, Colored illustration for T(3,2) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(3,3)
- Scott R. Shannon, Colored illustration for T(3,3) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(4,4)
- Scott R. Shannon, Colored illustration for T(4,4) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(5,5)
- Scott R. Shannon, Colored illustration for T(5,5) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(6,3)
- Scott R. Shannon, Colored illustration for T(6,3) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(7,4)
- Scott R. Shannon, Colored illustration for T(7,4) (edge number coloring)
- Scott R. Shannon, Colored illustration for T(8,2)
- Scott R. Shannon, Colored illustration for T(8,2) (edge number coloring)
- Scott R. Shannon, Numerical properties of these structures. Corrected version Mar 24 2020.
- N. J. A. Sloane, Illustration of T(3,2) = 192. [Black lines correspond to A331452(3,2), black + red lines correspond to A288187(3,2), and black + red + blue lines to T(3,2)]
- N. J. A. Sloane, Illustration of T(3,3) = 624 [Black lines correspond to A288187(3,3), and black + red lines to T(3,3)]
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
Showing 1-10 of 22 results.
Comments