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.

Previous Showing 11-16 of 16 results.

A300778 Number of grid points visible from a corner of an m X n rectangular region on a square grid written as triangle T(m,n), 1 <= n <= m.

Original entry on oeis.org

3, 4, 5, 5, 7, 9, 6, 8, 11, 13, 7, 10, 14, 17, 21, 8, 11, 15, 18, 23, 25, 9, 13, 18, 22, 28, 31, 37, 10, 14, 20, 24, 31, 34, 41, 45, 11, 16, 22, 27, 35, 38, 46, 51, 57, 12, 17, 24, 29, 37, 40, 49, 54, 61, 65, 13, 19, 27, 33, 42, 46, 56, 62, 70, 75, 85
Offset: 1

Views

Author

Hugo Pfoertner, Mar 12 2018

Keywords

Comments

Same as A049687, but written as triangle.

Examples

			The triangle starts:
  3
  4   5
  5   7   9
  6   8  11  13
  7  10  14  17  21
  8  11  15  18  23  25
  9  13  18  22  28  31  37
  ...
T(3,2) = 7, X indicating hidden grid points:
  0-----1#####X#####X
  |     |     |     |
  |     |     |     |
  2-----3-----4-----5
  #     | #   |     |
  #     |   # |     |
  X-----6-----X-----7
		

Crossrefs

Cf. A049687, A049691 (diagonal of triangle).

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)

A135646 a(m, n) is the number of coprime pairs (i, j) with 1 <= i <= m, 1 <= j <= n; table of a(m, n) read by antidiagonals.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 4, 5, 5, 4, 5, 6, 7, 6, 5, 6, 8, 9, 9, 8, 6, 7, 9, 12, 11, 12, 9, 7, 8, 11, 13, 15, 15, 13, 11, 8, 9, 12, 16, 16, 19, 16, 16, 12, 9, 10, 14, 18, 20, 21, 21, 20, 18, 14, 10, 11, 15, 20, 22, 26, 23, 26, 22, 20, 15, 11, 12, 17, 22, 25, 29, 29, 29, 29, 25, 22, 17, 12
Offset: 1

Views

Author

Hugo van der Sanden, Nov 22 2008

Keywords

Comments

A kind of 2-dimensional version of the Euler phi function A000010.

Examples

			a(2, 5) = 8 since of the 10 possible pairs all but (2, 2) and (2, 4) are coprime.
The terms given correspond to the following values:
   1 = a(1, 1)
   2  2 = a(2, 1), a(1, 2)
   3  3  3 = a(3, 1), a(2, 2), a(1, 3), etc.
   4  5  5  4
   5  6  7  6  5
   6  8  9  9  8  6
   7  9 12 11 12  9  7
   8 11 13 15 15 13 11  8
   9 12 16 16 19 16 16 12  9
  10 14 18 20 21 21 20 18 14 10
  etc.
		

Crossrefs

Cf. A000010 (Euler's totient function), A002088 (sum of totient function), A018805.
Cf. A049687.

Programs

  • PARI
    a(m,n) = sum(g=1, min(m,n), (m\g)*(n\g)*moebius(g)); \\ Andrew Howroyd, Sep 17 2017

Formula

a(m, n) = Sum_{g=1..min(m,n)} floor(m/g) * floor(n/g) * moebius(g). - Andrew Howroyd, Sep 17 2017
a(n, n) = 2*(Sum_{i=1..n} phi(i)) - 1 = 2*A002088(n) - 1 = A018805(n).
a(m, n) <= m*n - Sum_{i=1..m} ( (i - phi(i)) * floor(n / i) ).
Conjecture: a(m, n) ~ mn - sum_1^m{ (i - phi(i)) (n / i) } = n sum_1^m{ phi(i) / i } ~ 6mn / pi^2 as m -> oo.
a(m, n) = A049687(m, n) + 2. - Andrew Howroyd, Sep 17 2017

A339756 Mark each point on the n X 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, 4, 4, 8, 4, 17, 12, 15, 14, 33, 12, 58, 28, 43, 52, 113, 39, 140, 57, 124, 129, 240, 66, 241, 173, 270, 217, 362, 58, 388, 292, 454, 351, 539, 166, 783, 471, 723, 463, 880, 229, 1134, 642, 843, 763, 1441, 311, 1415, 740, 1295, 987, 1888, 357, 1629, 1063, 1750, 1231, 2381, 289, 2652
Offset: 1

Views

Author

Torlach Rush, Dec 15 2020

Keywords

Comments

a(n) <= A058187(n). This is because A058187(n) is the maximum number of points required to calculate a(n).

Examples

			a(1) = 1 because there are 7 visible points from every point on the grid.
a(2) = 4 because 19 points are visible from every vertex of the grid, 23 points are visible from the midpoint of every edge of the grid, 25 points are visible from the midpoint of every face of the grid, and 26 points are visible from the middle of the grid.
a(3) = 4 because 49 points are visible from every vertex of the grid, 53 points are visible from the inner points of every edge of the grid, 55 points are visible from the inner points of every face of the grid, and 56 points are visible from the inner points 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, 3)

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

A351522 Square array T(n, k) read by antidiagonals, n, k >= 0; T(n, k) is the number of distinct values in the set { T(i, j) with 0 <= i <= n and 0 <= j <= k and gcd(n-i, k-j) = 1 }.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 4, 4, 3, 1, 1, 3, 4, 3, 4, 3, 1, 1, 3, 5, 5, 5, 5, 3, 1, 1, 3, 4, 5, 4, 5, 4, 3, 1, 1, 3, 5, 5, 6, 6, 5, 5, 3, 1, 1, 3, 4, 5, 6, 5, 6, 5, 4, 3, 1, 1, 3, 5, 6, 6, 7, 7, 6, 6, 5, 3, 1, 1, 3, 4, 5, 6, 7, 6, 7, 6, 5, 4, 3, 1
Offset: 0

Views

Author

Rémy Sigrist, Feb 13 2022

Keywords

Comments

In other words, T(n, k) gives the number of distinct values in the rectangle with opposite corners (0, 0) and (n, k) visible from (n, k).

Examples

			Array T(n, k) begins:
  n\k|  0  1  2  3  4  5  6  7   8   9  10  11
  ---+----------------------------------------
    0|  0  1  1  1  1  1  1  1   1   1   1   1
    1|  1  2  3  3  3  3  3  3   3   3   3   3
    2|  1  3  3  4  4  5  4  5   4   5   4   5
    3|  1  3  4  3  5  5  5  5   6   5   6   6
    4|  1  3  4  5  4  6  6  6   6   7   6   7
    5|  1  3  5  5  6  5  7  7   8   8   8   8
    6|  1  3  4  5  6  7  6  8   8   8   8   8
    7|  1  3  5  5  6  7  8  7   9   9   9   9
    8|  1  3  4  6  6  8  8  9   8  10  10  11
    9|  1  3  5  5  7  8  8  9  10   9  11  11
   10|  1  3  4  6  6  8  8  9  10  11  10  12
   11|  1  3  5  6  7  8  8  9  11  11  12  11
		

Crossrefs

Cf. A049687.

Programs

  • PARI
    { T = matrix(M=13,M); for (d=1, #T, for (k=1, d, n=d+1-k; w=0; for (i=1, n, for (j=1, k, if (gcd(n-i, k-j)==1, w=bitor(w, 2^T[i,j])))); print1 (T[n,k] = hammingweight(w)", "))) }
    
  • Python
    from math import gcd
    from functools import cache
    @cache
    def T(n, k):
        return len(set(T(i, j) for i in range(n+1) for j in range(k+1) if gcd(n-i, k-j) == 1))
    def auptodiag(maxd):
        return [T(i, d-i) for d in range(maxd+1) for i in range(d+1)]
    print(auptodiag(12)) # Michael S. Branicky, Feb 13 2022

Formula

T(n, k) = T(k, n).
T(n, k) <= A049687(n, k).
Previous Showing 11-16 of 16 results.