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-3 of 3 results.

A049687 Array T read by diagonals: T(i,j)=number of lines passing through (0,0) and at least one other lattice point (h,k) satisfying 0<=h<=i, 0<=k<=j.

Original entry on oeis.org

0, 1, 1, 1, 3, 1, 1, 4, 4, 1, 1, 5, 5, 5, 1, 1, 6, 7, 7, 6, 1, 1, 7, 8, 9, 8, 7, 1, 1, 8, 10, 11, 11, 10, 8, 1, 1, 9, 11, 14, 13, 14, 11, 9, 1, 1, 10, 13, 15, 17, 17, 15, 13, 10, 1, 1, 11, 14, 18, 18, 21, 18, 18, 14, 11, 1, 1, 12, 16, 20, 22, 23, 23, 22, 20, 16, 12, 1, 1, 13, 17, 22, 24
Offset: 0

Views

Author

Keywords

Examples

			The array begins:
0 1 1 1 1  ...
1 3 4 5 6  ...
1 4 5 7 8  ...
1 5 7 9 11 ...
1 6 8 11 13 ...
...
		

Crossrefs

Main diagonal is A049691.

Programs

  • Mathematica
    a[0, 0] = 0; a[0, ] = a[, 0] = 1; a[i_, j_] := Module[{slopes, cnt}, slopes = Union @ Flatten @ Table[k/h, {h, 1, i }, {k, 1, j }]; cnt[ slope_] := Count[Flatten[Table[{h, k}, {h, 1, i }, {k, 1, j }], 1], {h_, k_} /; k/h == slope]; Count[cnt /@ slopes, c_ /; c >= 1] + 2]; Table[a[i-j, j], {i, 0, 12}, {j, 0, i}] // Flatten (* Jean-François Alcover, Apr 03 2017 *)
  • PARI
    T(i,j) = (i>0) + (j>0) + sum(g=1, min(i,j), (i\g) * (j\g) * moebius(g));
    for (i=0, 10, for(j=0, 10, print1(T(i,j), ", ")); print); \\ Andrew Howroyd, Sep 17 2017
    
  • PARI
    T(i,j) = sum(h=0, i, sum(k=0, j, gcd(h,k) == 1)); \\ Andrew Howroyd, Sep 17 2017

Formula

From Andrew Howroyd, Sep 17 2017: (Start)
T(i, j) = 2 + Sum_{g=1..min(i,j)} floor(i/g) * floor(j/g) * mu(g) for i > 0, j > 0.
T(i, j) = signum(i) + signum(j) + A135646(i, j).
T(i, j) = |{(x, y): gcd(x, y) = 1, 0<=x<=i, 0<=y<=j}|.
(End)

Extensions

More terms from Michael Somos

A339400 Mark each point on the n X n grid with the number of points that are visible from it; a(n) is the number of distinct values in the grid.

Original entry on oeis.org

1, 3, 3, 4, 3, 7, 5, 7, 7, 11, 5, 14, 8, 13, 13, 19, 9, 22, 11, 23, 21, 25, 13, 29, 21, 34, 26, 37, 11, 40, 26, 44, 31, 45, 21, 54, 35, 54, 36, 55, 24, 65, 40, 59, 47, 70, 24, 71, 43, 72, 55, 81, 28, 74, 55, 88, 59, 90, 28, 93, 58, 91, 66, 96, 46, 110, 63, 100
Offset: 1

Views

Author

Torlach Rush, Dec 02 2020

Keywords

Comments

a(n) <= A008805(n). This is because A008805(n) is the maximum number of points required to calculate a(n) and each point is located in the first quadrant.

Examples

			a(1) = 1 because there are 3 visible points from every point on the grid.
a(2) = 3 because 5 points are visible from every vertex of the grid, 7 points are visible from the midpoint of every edge of the grid, and 8 points are visible from the middle of the grid.
a(3) = 3 because 9 points are visible from every vertex of the grid, 11 points are visible from the inner points of every edge of the grid, and 12 points are visible from every inner point of the grid.
		

Crossrefs

Programs

  • PARI
    \\ n = side length, d = dimension
    cdvps(n, d) ={my(m=Map());
      forvec(u=vector(d, i, [0, n\2]),
        my(c=0); forvec(v=[[t-n, t]|t<-u], c+=(gcd(v)==1));
        mapput(m, c, 1), 1);
      #m; }
    a(n) = cdvps(n, 2)

A344533 Given a square forest of n X n trees, with rows and columns separated by 1 meter, a(n) is the number of trees visible to an observer halfway along one side of the forest, exactly one meter outside.

Original entry on oeis.org

1, 4, 7, 14, 17, 30, 33, 52, 51, 82, 81, 108, 105, 156, 143, 198, 183, 252, 231, 308, 267, 380, 339, 436, 383, 526, 461, 598, 525, 680, 595, 782, 663, 896, 767, 974, 839, 1118, 953, 1208, 1041, 1330, 1143, 1466, 1227, 1620, 1383, 1738, 1473, 1898, 1605, 2034
Offset: 1

Views

Author

John Mason, May 22 2021

Keywords

Comments

This concept has been studied under the name "visible lattice points" although the usual version considers the points in an n X n grid that are visible from the origin. - Jeffrey Shallit, May 22 2021

Examples

			For example, if the forest contains 5 X 5 trees, the observer will see only 17, as 8 will be hidden.
		

Crossrefs

Showing 1-3 of 3 results.