cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 16 results. Next

A295707 Square array A(n,k), n >= 1, k >= 1, read by antidiagonals, where A(n,k) is the number of lines through at least 2 points of an n X k grid of points.

Original entry on oeis.org

0, 1, 1, 1, 6, 1, 1, 11, 11, 1, 1, 18, 20, 18, 1, 1, 27, 35, 35, 27, 1, 1, 38, 52, 62, 52, 38, 1, 1, 51, 75, 93, 93, 75, 51, 1, 1, 66, 100, 136, 140, 136, 100, 66, 1, 1, 83, 131, 181, 207, 207, 181, 131, 83, 1, 1, 102, 164, 238, 274, 306, 274, 238, 164, 102, 1
Offset: 1

Views

Author

Seiichi Manyama, Nov 26 2017

Keywords

Examples

			Square array begins:
   0,  1,  1,   1,   1, ...
   1,  6, 11,  18,  27, ...
   1, 11, 20,  35,  52, ...
   1, 18, 35,  62,  93, ...
   1, 27, 52,  93, 140, ...
   1, 38, 75, 136, 207, ...
		

Crossrefs

Main diagonal gives A018808. Reading up to the diagonal gives A107348.

Programs

  • Mathematica
    A[n_, k_] := (1/2)(f[n, k, 1] - f[n, k, 2]);
    f[n_, k_, m_] := Sum[If[GCD[mx/m, my/m] == 1, (n - Abs[mx])(k - Abs[my]), 0], {mx, -n, n}, {my, -k, k}];
    Table[A[n - k + 1, k], {n, 1, 11}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jun 04 2023 *)

Formula

A(n,k) = (1/2) * (f(n,k,1) - f(n,k,2)), where f(n,k,m) = Sum ((n-|m*x|)*(k-|m*y|)); -n < m*x < n, -k < m*y < k, (x,y)=1.

A222267 The number of distinct lines defined by an n X n X n grid of points.

Original entry on oeis.org

28, 253, 1492, 5485, 17092, 41905, 95140, 191773, 364420, 638785, 1085500, 1745389, 2743084, 4136257, 6101740, 8747821, 12377764, 17066737, 23287564, 31174813, 41276548, 53767873, 69544324, 88722973, 112450132, 140859361, 175324636
Offset: 2

Views

Author

Clive Tooth, Feb 13 2013

Keywords

Comments

Given a cubic n X n X n grid of points, a(n) is the number of distinct lines produced by constructing a line through every pair of points.
Define the grid as consisting of the set of n^3 distinct points whose x, y and z coordinates are all integers in [0..n-1]. Assign to each grid point a distinct index j = x + n*y + n^2*z. For each pair of grid points P_A and P_B (where P_A is the one with the lower index j), let L be the line that passes through both grid points, and let S be the segment of that line from P_A to P_B. Examine each of the C(n^3,2) pairs of distinct grid points P_A and P_B; a(n) is the number of those pairs for which S does not pass through any other grid points between P_A and P_B, nor does L pass through any other grid points beyond the P_A end of S. - Jon E. Schoenfield, Sep 21 2013
Conjecture: a(n) is approximately 0.3639537*n^6, with a relative error of about 10^-5 when n is near 200. - Clive Tooth, Mar 03 2016

Examples

			Each of the 28 pairs of points on a 2 X 2 X 2 grid of points defines a distinct line, so a(2) = 28.
Of the 351 pairs of points on a 3 X 3 X 3 grid, there are only 253 distinct lines, so a(3) = 253.
		

Crossrefs

Cf. A018808, A222268 (number of intersection points of these lines).

Programs

  • Mathematica
    mq[{x1_, y1_}, {x2_, y2_}] := If[x1 == x2, {x1}, {y2 - y1, x2*y1 - x1*y2}/(x2 - x1)]; two[n_] := Block[{p = Tuples[Range@n, 2]},
    Length@Union@Flatten[Table[mq[p[[i]], p[[j]]], {i, 2, n^2}, {j, i - 1}], 1]]; coef[a_, b_] := Block[{d = b - a}, If[d[[1]] == 0, {0}, d *= Sign@d[[1]]/GCD @@ d; {a - d*a[[1]]/d[[1]], d}]]; a[n_] := Block[{p = Tuples[Range@n, 3]}, n*two[n] - 1 + Length@Union@ Flatten[Table[coef[p[[i]], p[[j]]], {i, 2, n^3}, {j, i - 1}], 1]]; Table[v = a[n]; Print@v; v, {n, 2, 12}] (* Giovanni Resta, Feb 14 2013 *)

Extensions

a(6)-a(12) from Giovanni Resta, Feb 14 2013
a(13)-a(28) from Jon E. Schoenfield, Sep 16 2013

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

Views

Author

Keywords

Comments

Triangle gives number of nodes in graph LC(m,n) in the notation of Blomberg-Shannon-Sloane (2020).
If we only joined pairs of the 2(m+n) boundary points, we would get A331452. If we did not extend the lines to the boundary of the grid, we would get A288187. (One of the links below shows the difference between the three definitions in the case m=3, n=2.)

Examples

			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
		

Crossrefs

Cf. A288187, A331452, A333283 (edges), A333284 (vertices). Column 1 is A306302. Main diagonal is A333294.

Extensions

More terms and corrections from Scott R. Shannon, Mar 21 2020
More terms from Scott R. Shannon, May 27 2021

A107348 Triangle read by rows: T(m,n) = number of different lines in a rectangular m X n array of points with integer coordinates (x,y): 0 <= x <= m, 0 <= y <= n.

Original entry on oeis.org

0, 1, 6, 1, 11, 20, 1, 18, 35, 62, 1, 27, 52, 93, 140, 1, 38, 75, 136, 207, 306, 1, 51, 100, 181, 274, 405, 536, 1, 66, 131, 238, 361, 534, 709, 938, 1, 83, 164, 299, 454, 673, 894, 1183, 1492, 1, 102, 203, 370, 563, 836, 1111, 1470, 1855, 2306
Offset: 0

Views

Author

Dan Dima, May 23 2005

Keywords

Comments

We may assume n <= m since T(m,n)=T(n,m).

Examples

			Triangle begins
0,
1, 6,
1, 11, 20,
1, 18, 35, 62,
1, 27, 52, 93, 140,
1, 38, 75, 136, 207, 306,
1, 51, 100, 181, 274, 405, 536,
1, 66, 131, 238, 361, 534, 709, 938,
1, 83, 164, 299, 454, 673, 894, 1183, 1492,
1, 102, 203, 370, 563, 836, 1111, 1470, 1855, 2306,
...
		

Crossrefs

Cf. A295707 (symmetric array), A018808 (diagonal). A160842 - A160850 (columns).

Programs

  • Maple
    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;
    LL:=(m,n)->(VR(m,n,1)-VR(m,n,2))/2;
    for m from 1 to 12 do lprint([seq(LL(m,n),n=1..m)]); od: # N. J. A. Sloane, Feb 10 2020
  • Mathematica
    VR[m_, n_, q_] := Sum[If[GCD[i, j] == q, (m - Abs[i])(n - Abs[j]), 0], {i, -m + 1, m - 1}, {j, -n + 1, n - 1}];
    LL[m_, n_] := (1/2)(VR[m, n, 1] - VR[m, n, 2]);
    Table[LL[m, n], {m, 1, 10}, {n, 1, m}] // Flatten (* Jean-François Alcover, Jun 04 2023, after N. J. A. Sloane *)

Formula

T(0, 0) = 0; T(m, 0) = 1, m >= 1.
When both m,n -> +oo, T(m,n) / 2Cmn -> 9/(2*pi^2). - Dan Dima, Mar 18 2006
T(n,m) = A295707(n,m). - R. J. Mathar, Dec 17 2017

Extensions

T(3,3) corrected and sequence extended by R. J. Mathar, Dec 17 2017

A119437 Table T(n,k) = number of lines through exactly k points of an n X n grid of points.

Original entry on oeis.org

6, 12, 8, 48, 4, 10, 108, 16, 4, 12, 248, 36, 4, 4, 14, 428, 64, 20, 4, 4, 16, 764, 100, 44, 4, 4, 4, 18, 1196, 204, 36, 24, 4, 4, 4, 20, 1900, 252, 64, 52, 4, 4, 4, 4, 22, 2668, 396, 124, 40, 28, 4, 4, 4, 4, 24, 3824, 572, 200, 20, 60, 4, 4, 4, 4, 4, 26, 5244, 780, 236, 76, 44, 32
Offset: 2

Views

Author

Keywords

Examples

			From _Seiichi Manyama_, Nov 26 2017: (Start)
The table starts:
  n\k|   2    3   4   5   6   7   8
  ---+------------------------------
   2 |   6;
   3 |  12,   8;
   4 |  48,   4, 10;
   5 | 108   16,  4, 12;
   6 | 248,  36,  4,  4, 14;
   7 | 428,  64, 20,  4,  4, 16;
   8 | 764, 100, 44,  4,  4,  4, 18; (End)
		

Crossrefs

Row sums A018808; columns A018809-A018817. See A119439 for another version.

Formula

T(n,k) = 1/2 (f(n, k+1) - 2 f(n, k) + f(n, k-1)) where f(n, k) = Sum_{-n < kx < n, -n < ky < n, gcd(x, y)=1} (n - |kx|)*(n - |ky|). [Seppo Mustonen, Apr 18 2009]

Extensions

An incorrect formula removed by Seppo Mustonen, Apr 25 2009

A160842 Number of lines through at least 2 points of a 2 X n grid of points.

Original entry on oeis.org

0, 1, 6, 11, 18, 27, 38, 51, 66, 83, 102, 123, 146, 171, 198, 227, 258, 291, 326, 363, 402, 443, 486, 531, 578, 627, 678, 731, 786, 843, 902, 963, 1026, 1091, 1158, 1227, 1298, 1371, 1446, 1523, 1602, 1683, 1766, 1851, 1938, 2027, 2118, 2211, 2306, 2403, 2502
Offset: 0

Views

Author

Seppo Mustonen, May 28 2009

Keywords

Crossrefs

Programs

  • Magma
    [0,1] cat [n^2 + 2: n in [2..100]]; // G. C. Greubel, Apr 30 2018
  • Mathematica
    a[n_]:=If[n<2,n,n^2+2] Table[a[n],{n,0,50}]
    Join[{0,1},Range[2,50]^2+2] (* Harvey P. Dale, Feb 06 2015 *)
  • PARI
    Vec(-x*(2*x^3-4*x^2+3*x+1) / (x-1)^3 + O(x^100)) \\ Colin Barker, May 24 2015
    

Formula

a(n) = n^2 + 2 = A059100(n) = A010000(n) for n > 1.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 4. - Colin Barker, May 24 2015
G.f.: -x*(2*x^3 - 4*x^2 + 3*x + 1) / (x-1)^3. - Colin Barker, May 24 2015
Sum_{n>=1} 1/a(n) = Pi * coth(sqrt(2)*Pi) / 2^(3/2) - 1/4. - Vaclav Kotesovec, May 01 2018

A187397 Expansion of -2*x^4 *(3*x^13 +2*x^12 +x^11 -6*x^10 -10*x^9 -6*x^8 +x^7 +7*x^6 +5*x^5 -x^4 -8*x^3 -11*x^2 -8*x -5) / ((x -1)^4 *(x +1)^2 *(x^2 +1)^2 *(x^2 +x +1)^2).

Original entry on oeis.org

0, 0, 0, 0, 10, 16, 22, 36, 54, 66, 92, 122, 156, 196, 240, 288, 366, 426, 490, 590, 698, 780, 904, 1036, 1176, 1326, 1484, 1650, 1874, 2060, 2254, 2512, 2782, 3006, 3300, 3606, 3924, 4256, 4600, 4956, 5398, 5782, 6178, 6666, 7170, 7608, 8144
Offset: 0

Views

Author

Sean A. Irvine, Mar 23 2011

Keywords

Comments

In contrast, the number of distinct lines passing through 4 or more points in an n X n grid is given by 0, 0, 0, 10, 16, 22, 44, 74, 92, 154, 232, 326, 436, 562, 704, 998, 1268,.. = A018808(n) -A018809(n) -A018810(n) = A225606(n) -A018810(n). - David W. Wilson, Aug 05 2013

Crossrefs

Programs

  • Mathematica
    CoefficientList[ Series[ 2x^4 (5 + 8x + 11x^2 + 8x^3 + x^4 - 5x^5 - 7x^6 - x^7 + 6x^8 + 10x^9 + 6x^10 - x^11 - 2x^12 - 3x^13)/((-1 + x)^4 (1 + x)^2 (1 + x^2)^2 (1 + x + x^2)^2), {x, 0, 43}], x] (* or *) LinearRecurrence[{0, 0, 2, 2, 0, -1, -4, -1, 0, 2, 2, 0, 0, -1}, {10, 16, 22, 36, 54, 66, 92, 122, 156, 196, 240, 288, 366, 426}, 40] (* Robert G. Wilson v, Feb 17 2014 *)

Extensions

Definition replaced with Colin Barker's g.f. by R. J. Mathar, Aug 06 2013
Offset changed from 1 to 0 and a(0)=0 added by Vincenzo Librandi, Feb 19 2014

A225606 Number of distinct lines passing through 3 or more points in an n X n grid.

Original entry on oeis.org

0, 0, 0, 8, 14, 32, 58, 108, 174, 296, 406, 628, 898, 1216, 1582, 2188, 2754, 3528, 4398, 5524, 6778, 8336, 9778, 11812, 14038, 16456, 19066, 22540, 25954, 29968, 34270, 39116, 44282, 50312, 56026, 63196, 70798, 78984
Offset: 0

Views

Author

R. J. Mathar, Aug 06 2013

Keywords

Programs

  • Mathematica
    f[n_, k_] := Sum[x = kx/k; y = ky/k; If[IntegerQ[x] && IntegerQ[y] && CoprimeQ[x, y], (n - Abs[kx])(n - Abs[ky]), 0], {kx, -n + 1, n - 1}, {ky, -n + 1, n - 1}];
    a[n_] := (f[n, 2] - f[n, 3])/2;
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Oct 30 2018, after Seppo Mustonen in A018808 *)

Formula

a(n) = A018808(n) - A018809(n) = A018810(n) + A018811(n) + A018812(n) + A018813(n)+....

A333283 Triangle read by rows: T(m,n) (m >= n >= 1) = number of edges 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

8, 28, 92, 80, 320, 1028, 178, 716, 2348, 5512, 372, 1604, 5332, 12676, 28552, 654, 2834, 9404, 22238, 49928, 87540, 1124, 5008, 16696, 39496, 88540, 156504, 279100, 1782, 7874, 26458, 62818, 141386, 251136, 447870
Offset: 1

Views

Author

Keywords

Comments

If we only joined pairs of the 2(m+n) boundary points, we would get A331454. If we did not extend the lines to the boundary of the grid, we would get A333278. (One of the links below shows the difference between the three definitions in the case m=3, n=2.)
See A333282 for a large number of colored illustrations.

Examples

			Triangle begins:
8,
28, 92,
80, 320, 1028,
178, 716, 2348, 5512,
372, 1604, 5332, 12676, 28552,
654, 2834, 9404, 22238, 49928, 87540,
1124, 5008, 16696, 39496, 88540, 156504, 279100,
1782, 7874, 26458, 62818, 141386, 251136, 447870, ...
...
T(7,7) corrected Mar 19 2020
		

Crossrefs

Cf. A288187, A331452, A333278, A331454, A333282 (regions), A333284 (vertices). Column 1 is A331757.

Extensions

More terms and corrections from Scott R. Shannon, Mar 21 2020

A178465 Expansion of -2*x^2*(-3-2*x+x^2-x^3-2*x^4+x^5) / ( (1+x)^2*(x-1)^4 ).

Original entry on oeis.org

0, 0, 6, 16, 36, 66, 114, 176, 264, 370, 510, 672, 876, 1106, 1386, 1696, 2064, 2466, 2934, 3440, 4020, 4642, 5346, 6096, 6936, 7826, 8814, 9856, 11004, 12210, 13530, 14912, 16416, 17986, 19686, 21456, 23364, 25346, 27474, 29680, 32040, 34482
Offset: 0

Views

Author

Sean A. Irvine, Mar 23 2011

Keywords

Crossrefs

Programs

  • Mathematica
    CoefficientList[ Series[ 2x^2 (3 + 2x - x^2 + x^3 + 2x^4 - x^5)/((1 + x)^2 (x - 1)^4), {x, 0, 42}], x] (* Robert G. Wilson v, Feb 17 2014 *)
  • Python
    def A178465(n): return n+(m:=n&1)+(n*(n**2-m)>>1) if n != 1 else 0 # Chai Wah Wu, Aug 30 2022

Formula

For n even, a(n) = n*(2+n^2)/2 = A061804(n/2). For n>1 and odd, a(n)=(n+1)*(n^2-n+2)/2 = 2*A212133((n+1)/2).
a(n) = (2-2*(-1)^n+(3+(-1)^n)*n+2*n^3)/4 for n>1. [Colin Barker, Feb 18 2013]

Extensions

Discrepancy with A018808 resolved. David W. Wilson, Aug 05 2013
First line of formulas corrected. R. J. Mathar, Aug 05 2013
Prepended a(0)=0, Joerg Arndt, Feb 19 2014
Showing 1-10 of 16 results. Next