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.

A332596 Number of quadrilateral regions in a "frame" of size n X n (see Comments in A331776 for definition), divided by 8.

Original entry on oeis.org

0, 1, 10, 26, 63, 107, 189, 294, 455, 627, 891, 1202, 1650, 2121, 2719, 3392, 4292, 5239, 6470, 7832, 9463, 11129, 13205, 15460, 18164, 20919, 24130, 27572, 31679, 35945, 40977, 46340, 52384, 58511, 65421, 72718, 81104, 89589, 98989, 108860, 120062, 131551
Offset: 1

Views

Author

Keywords

Comments

See A331776 for many other illustrations.
Theorem. Let z(n) = Sum_{i, j = 1..n, gcd(i,j)=1} (n+1-i)*(n+1-j) (this is A115004) and z_2(n) = Sum_{i, j = 1..n, gcd(i,j)=2} (n+1-i)*(n+1-j) (this is A331761). Then, for n >= 2, 8*a(n) = 4*z(n) - 8*z_2(n) + 8*n^2 - 36*n + 24. - Scott R. Shannon and N. J. A. Sloane, Mar 06 2020

Crossrefs

Programs

  • Maple
    V := proc(m, n, q) local a, i, j; a:=0;
    for i from 1 to m do for j from 1 to n do
    if gcd(i, j)=q then a:=a+(m+1-i)*(n+1-j); fi; od: od: a; end;
    f := n -> if n=1 then 0 else 8*n^2 - 36*n + 24 + 4*V(n,n,1) 8*V(n, n, 2); fi;
    [seq(f(n)/8, n=1..60)]; # N. J. A. Sloane, Mar 10 2020
  • PARI
    a(n) = sum(i=1, n, sum(j=1, n, if(gcd(i, j)==1, (n+1-i)*(n+1-j), 0)))/2 - sum(i=1, n, sum(j=1, n, if(gcd(i, j)==2, (n+1-i)*(n+1-j), 0))) + n^2 - 9*n/2 + 3; \\ Jinyuan Wang, Aug 07 2021
    
  • Python
    from sympy import totient
    def A332596(n): return 0 if n == 1 else ((n-1)*(n-4) - sum(totient(i)*(n+1-i)*(2*n+2-7*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)))//2 # Chai Wah Wu, Aug 16 2021

Formula

For n > 1, a(n) = ((n-1)*(n-4) - Sum_{i=2..floor(n/2)} (n+1-i)*(2*n+2-7*i)*phi(i) + Sum_{i=floor(n/2)+1..n} (n+1-i)*(2*n+2-i)*phi(i))/2. - Chai Wah Wu, Aug 16 2021

Extensions

More terms from N. J. A. Sloane, Mar 10 2020