OFFSET
1,2
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
M. Griffiths, Counting the regions in a regular drawing of K_{n,n}, J. Int. Seq. 13 (2010) # 10.8.5, Table 2.
MATHEMATICA
b[n_] := Sum[(n-i+1)(n-j+1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
A290131[n_] := b[n-1] + (n-1)^2;
A159065[n_] := Module[{x, y, s1 = 0, s2 = 0}, For[x = 1, x <= n - 1, x++, For[y = 1, y <= n - 1, y++, If[GCD[x, y] == 1, s1 += (n - x)(n - y); If[2x <= n - 1 && 2y <= n - 1, s2 += (n - 2x)(n - 2y)]]]]; s1 - s2];
PROG
(Python)
from math import gcd
def a115004(n):
r=0
for a in range(1, n + 1):
for b in range(1, n + 1):
if gcd(a, b)==1:r+=(n + 1 - a)*(n + 1 - b)
return r
def a159065(n):
c=0
for a in range(1, n):
for b in range(1, n):
if gcd(a, b)==1:
c+=(n - a)*(n - b)
if 2*a<n and 2*b<n:c-=(n - 2*a)*(n - 2*b)
return c
def a290131(n): return a115004(n - 1) + (n - 1)**2
def a(n): return 2*n + a290131(n) + a159065(n) - 1
print([a(n) for n in range(1, 51)]) # Indranil Ghosh, Jul 20 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
R. J. Mathar, Jul 20 2017
STATUS
approved