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.

A332598 Number of vertices in a "frame" of size n X n (see Comments in A331776 for definition).

This page as a plain text file.
%I A332598 #29 Aug 16 2021 14:03:57
%S A332598 5,27,152,364,776,1340,2272,3532,5336,7516,10592,14316,19328,25100,
%T A332598 32176,40428,50848,62476,76824,93020,111880,132492,157056,184140,
%U A332598 215552,249452,287928,329900,378216,429852,488768,552572,623104,697884,780464,868588,967056
%N A332598 Number of vertices in a "frame" of size n X n (see Comments in A331776 for definition).
%C A332598 See A331776 for many other illustrations.
%C A332598 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 >= 3, a(n) = 4*z(n) - 4*z_2(n) + 12*n^2 - 24*n + 8. (This does not hold for n<3, because it uses Euler's formula, and the graph for n<3 has no hole, so has genus 0, whereas for n>=3 there is a hole and the graph has genus 1.) - _Scott R. Shannon_ and _N. J. A. Sloane_, Mar 04 2020
%H A332598 Jinyuan Wang, <a href="/A332598/b332598.txt">Table of n, a(n) for n = 1..1000</a>
%H A332598 Scott R. Shannon, <a href="/A331776/a331776.png">Colored illustration for a(3) = 152</a> (there are 152 vertices in this picture).
%F A332598 For n > 2, a(n) = 4*(n-1)*(3n-1)+12*Sum_{i=2..floor(n/2)} (n+1-i)*i*phi(i) + 4*Sum_{i=floor(n/2)+1..n} (n+1-i)*(2*n+2-i)*phi(i). - _Chai Wah Wu_, Aug 16 2021
%p A332598 V := proc(m, n, q) local a, i, j; a:=0;
%p A332598 for i from 1 to m do for j from 1 to n do
%p A332598 if gcd(i, j)=q then a:=a+(m+1-i)*(n+1-j); fi; od: od: a; end;
%p A332598 f := n -> if n=1 then 5 elif n=2 then 27 else 12*n^2 - 24*n + 8 + 4*V(n,n,1) - 4*V(n, n, 2); fi;
%p A332598 [seq(f(n), n=1..50)]; # _N. J. A. Sloane_, Mar 10 2020
%o A332598 (PARI) a(n) = if(n<3, 22*n - 17, 4*sum(i=1, n, sum(j=1, n, if(gcd(i, j)==1, (n+1-i)*(n+1-j), 0))) - 4*sum(i=1, n, sum(j=1, n, if(gcd(i, j)==2, (n+1-i)*(n+1-j), 0))) + 12*n^2 - 24*n + 8); \\ _Jinyuan Wang_, Aug 07 2021
%o A332598 (Python)
%o A332598 from sympy import totient
%o A332598 def A332598(n): return 22*n-17 if n <= 2 else 4*(n-1)*(3*n-1) + 12*sum(totient(i)*(n+1-i)*i for i in range(2,n//2+1)) + 4*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 A332598 Cf. A331776 (regions), A332597 (edges).
%K A332598 nonn
%O A332598 1,1
%A A332598 _Scott R. Shannon_ and _N. J. A. Sloane_, Mar 02 2020
%E A332598 More terms from _N. J. A. Sloane_, Mar 10 2020