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 A332597 #24 Aug 16 2021 13:51:55 %S A332597 8,92,360,860,1792,3124,5256,8188,12304,17460,24568,33244,44688,58228, %T A332597 74664,94028,118080,145380,178568,216252,259776,308276,365352,428556, %U A332597 501152,580804,670536,768908,880992,1001764,1138248,1286748,1449984,1625300,1817752,2023740,2252048,2495476,2759304,3040460,3349056 %N A332597 Number of edges in a "frame" of size n X n (see Comments in A331776 for definition). %C A332597 See A331776 for many other illustrations. %C A332597 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, a(n) = 8*z(n) - 4*z_2(n) + 28*n^2 - 44*n + 8. - _Scott R. Shannon_ and _N. J. A. Sloane_, Mar 06 2020 %H A332597 Chai Wah Wu, <a href="/A332597/b332597.txt">Table of n, a(n) for n = 1..10000</a> %H A332597 Scott R. Shannon, <a href="/A331776/a331776.png">Colored illustration for a(3) = 360</a> (there are 360 edges in this picture). %F A332597 For n > 1, a(n) = 4*(n-1)*(8*n-1) + 8*Sum_{i=2..floor(n/2)} (n+1-i)*(n+i+1)*phi(i) + 8*Sum_{i=floor(n/2)+1..n} (n+1-i)*(2*n+2-i)*phi(i). - _Chai Wah Wu_, Aug 16 2021 %p A332597 V := proc(m, n, q) local a, i, j; a:=0; %p A332597 for i from 1 to m do for j from 1 to n do %p A332597 if gcd(i, j)=q then a:=a+(m+1-i)*(n+1-j); fi; od: od: a; end; %p A332597 f := n -> if n=1 then 8 else 28*n^2 - 44*n + 8 + 8*V(n,n,1) - 4*V(n, n, 2); fi; %p A332597 [seq(f(n), n=1..50)]; # _N. J. A. Sloane_, Mar 10 2020 %o A332597 (Python) %o A332597 from sympy import totient %o A332597 def A332597(n): return 8 if n == 1 else 4*(n-1)*(8*n-1) + 8*sum(totient(i)*(n+1-i)*(n+i+1) for i in range(2,n//2+1)) + 8*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 %Y A332597 Cf. A115004, A331761, A331776 (regions), A332598 (vertices). %K A332597 nonn %O A332597 1,1 %A A332597 _Scott R. Shannon_ and _N. J. A. Sloane_, Mar 02 2020 %E A332597 More terms from _N. J. A. Sloane_, Mar 10 2020