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.

A331757 Number of edges in a figure made up of a row of n adjacent congruent rectangles upon drawing diagonals of all possible rectangles.

Original entry on oeis.org

8, 28, 80, 178, 372, 654, 1124, 1782, 2724, 3914, 5580, 7626, 10352, 13590, 17540, 22210, 28040, 34670, 42760, 51962, 62612, 74494, 88508, 104042, 121912, 141534, 163664, 187942, 215636, 245490, 279260, 316022, 356456, 399898, 447612, 498698, 555352
Offset: 1

Views

Author

N. J. A. Sloane, Feb 04 2020

Keywords

Crossrefs

A306302 gives number of regions in the figure.
This is column 1 of A331454.

Programs

  • Mathematica
    Table[n^2 + 4n + 1 + Sum[Sum[(2 * Boole[GCD[i, j] == 1] - Boole[GCD[i, j] == 2]) * (n + 1 - i) * (n + 1 - j), {j, 1, n}], {i, 1, n}], {n, 1, 37}] (* Joshua Oliver, Feb 05 2020 *)
  • Python
    from sympy import totient
    def A331757(n): return 8 if n == 1 else 2*(n*(n+3) + sum(totient(i)*(n+1-i)*(n+1+i) for i in range(2,n//2+1)) + sum(totient(i)*(n+1-i)*(2*n+2-i) for i in range(n//2+1,n+1))) # Chai Wah Wu, Aug 16 2021

Formula

a(n) = (2*n + 2 + 3*A324042(n) + 4*A324043(n))/2 [Corrected by Chai Wah Wu, Aug 16 2021]
For n > 1, a(n) = 2*(n*(n+3) + Sum_{i=2..floor(n/2)} (n+1-i)*(n+1+i)*phi(i) + Sum_{i=floor(n/2)+1..n} (n+1-i)*(2*n+2-i)*phi(i)). - Chai Wah Wu, Aug 16 2021