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.

A332350 Triangle read by rows: T(m,n) = Sum_{-m= n >= 1.

Original entry on oeis.org

0, 2, 12, 4, 26, 56, 6, 44, 98, 172, 8, 66, 148, 262, 400, 10, 92, 210, 376, 578, 836, 12, 122, 280, 502, 772, 1118, 1496, 14, 156, 362, 652, 1006, 1460, 1958, 2564, 16, 194, 452, 818, 1264, 1838, 2468, 3234, 4080, 18, 236, 554, 1004, 1554, 2264, 3042, 3988, 5034, 6212
Offset: 1

Views

Author

N. J. A. Sloane, Feb 10 2020

Keywords

Examples

			Triangle begins:
0,
2, 12,
4, 26, 56,
6, 44, 98, 172,
8, 66, 148, 262, 400,
10, 92, 210, 376, 578, 836,
12, 122, 280, 502, 772, 1118, 1496,
14, 156, 362, 652, 1006, 1460, 1958, 2564,
16, 194, 452, 818, 1264, 1838, 2468, 3234, 4080,
18, 236, 554, 1004, 1554, 2264, 3042, 3988, 5034, 6212,
...
		

Crossrefs

The main diagonal is A331771.

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;
    for m from 1 to 12 do lprint(seq(VR(m,n,1),n=1..m),); od:
  • Mathematica
    T[m_, n_] := Sum[Boole[GCD[i, j] == 1] (m - Abs[i]) (n - Abs[j]), {i, -m + 1, m - 1}, {j, -n + 1, n - 1}];
    Table[T[m, n], {m, 1, 12}, {n, 1, m}] // Flatten (* Jean-François Alcover, Apr 19 2020 *)

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

Views

Author

Keywords

Comments

Related to the number of linear dichotomies on a square grid.
A331771(n) = 8*a(n) + 4*n*(n-1) + 4*(n-1)^2.

Crossrefs

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.

Programs

  • Maple
    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)];
  • PARI
    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
    
  • Python
    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

Formula

a(n) = (Sum_{i=2..n-1} (n-i)*(2n-i)*phi(i))/2. - Chai Wah Wu, Aug 17 2021

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