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.
%I A332596 #35 Aug 16 2021 14:47:39 %S A332596 0,1,10,26,63,107,189,294,455,627,891,1202,1650,2121,2719,3392,4292, %T A332596 5239,6470,7832,9463,11129,13205,15460,18164,20919,24130,27572,31679, %U A332596 35945,40977,46340,52384,58511,65421,72718,81104,89589,98989,108860,120062,131551 %N A332596 Number of quadrilateral regions in a "frame" of size n X n (see Comments in A331776 for definition), divided by 8. %C A332596 See A331776 for many other illustrations. %C A332596 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 %H A332596 Jinyuan Wang, <a href="/A332596/b332596.txt">Table of n, a(n) for n = 1..1000</a> %H A332596 Scott R. Shannon, <a href="/A331776/a331776.png">Colored illustration for a(3) = 10</a> (there are 8*10 quadrilaterals). %F A332596 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 %p A332596 V := proc(m, n, q) local a, i, j; a:=0; %p A332596 for i from 1 to m do for j from 1 to n do %p A332596 if gcd(i, j)=q then a:=a+(m+1-i)*(n+1-j); fi; od: od: a; end; %p A332596 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; %p A332596 [seq(f(n)/8, n=1..60)]; # _N. J. A. Sloane_, Mar 10 2020 %o A332596 (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 %o A332596 (Python) %o A332596 from sympy import totient %o A332596 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 %Y A332596 Cf. A115004, A331761, A331776, A332594, A332595. %K A332596 nonn %O A332596 1,3 %A A332596 _Scott R. Shannon_ and _N. J. A. Sloane_, Mar 02 2020 %E A332596 More terms from _N. J. A. Sloane_, Mar 10 2020