OFFSET
1,1
COMMENTS
A "frame" of size n X n is formed from a grid of (n+1) X (n+1) points with the central grid of (n-3) X (n-3) points removed. If n is less than 3 then no points are removed, and a(n) = A255011(n). From now on we assume n >= 3.
If we focus on the squares rather than the points, the frame consists of an n X n array of squares with the central block of (n-2) X (n-2) squares removed.
The resulting structure has an outer perimeter with 4*n points and an inner perimeter with 4*n-8 points, for a total of 8*n-8 perimeter points. The frame itself is the strip of width 1 between the inner and outer perimeters.
Now join every pair of perimeter points, both inner and outer, by a line segment, provided the line remains inside the frame. The sequence gives the number of regions in the resulting figure.
Theorem. Let z(n) = Sum_{i, j = 1..n, gcd(i,j)=1} (n+1-i)*(n+1-j) (this is A115004). Then, for n >= 2, a(n) = 4*z(n) + 16*n^2 - 20*n. - Scott R. Shannon and N. J. A. Sloane, Mar 06 2020
LINKS
Jinyuan Wang, Table of n, a(n) for n = 1..1000
Scott R. Shannon, Colored illustration for a(1) = 4
Scott R. Shannon, Colored illustration for a(2) = 56
Scott R. Shannon, Colored illustration for a(3) = 208
Scott R. Shannon, Colored illustration for a(4) = 496
Scott R. Shannon, Colored illustration for a(5) = 1016
Scott R. Shannon, Colored illustration for a(6) = 1784
Scott R. Shannon, Colored illustration for a(7) = 2984
Scott R. Shannon, Colored illustration for a(8) = 4656
Scott R. Shannon, Colored illustration for a(8) = 4656 (Another version)
Zach Shannon, Illustration for a(8) = 4656 used as a frame for the OEIS logo (detail)
N. J. A. Sloane, Illustration for a(3) = 208
FORMULA
For n > 1, a(n) = 20*n*(n-1) + 4*Sum_{i=2..n} (n+1-i)*(2n+2-i)*phi(i). - Chai Wah Wu, Aug 16 2021
MAPLE
# First define z(n) = A115004
z := proc(n)
local a, b, r ;
r := 0 ;
for a from 1 to n do
for b from 1 to n do
if igcd(a, b) = 1 then
r := r+(n+1-a)*(n+1-b);
end if;
end do:
end do:
r ;
end proc:
A331776 := n -> if n=1 then 4 else 4*z(n)+16*n^2 - 20*n; fi;
[seq(A331776(n), n=1..40)]; # N. J. A. Sloane, Mar 09 2020
PROG
(PARI) a(n) = 4*sum(i=1, n, sum(j=1, n, if(gcd(i, j)==1, (n+1-i)*(n+1-j), 0))) + 16*n^2 - 20*n + 4*(n==1); \\ Jinyuan Wang, Aug 07 2021
(Python)
from sympy import totient
def A331776(n): return 4 if n == 1 else 20*n*(n-1) + 4*sum(totient(i)*(n+1-i)*(2*n+2-i) for i in range(2, n+1)) # Chai Wah Wu, Aug 16 2021
CROSSREFS
The analogous sequence for an n X n block of squares (if the center block is not removed) is A331452.
KEYWORD
nonn
AUTHOR
Scott R. Shannon and N. J. A. Sloane, Feb 08 2020
EXTENSIONS
More terms from N. J. A. Sloane, Mar 09 2020
STATUS
approved