

A115004


a(n) = Sum_{i=1..n, j=1..n, gcd(i,j)=1} (n+1i)*(n+1j).


94



1, 8, 31, 80, 179, 332, 585, 948, 1463, 2136, 3065, 4216, 5729, 7568, 9797, 12456, 15737, 19520, 24087, 29308, 35315, 42120, 50073, 58920, 69025, 80264, 92871, 106756, 122475, 139528, 158681, 179608, 202529, 227400, 254597, 283784, 315957, 350576, 387977
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Also (1/4) * number of ways to select 3 distinct points forming a triangle of unsigned area = 1/2 from a square of grid points with side length n. Diagonal of triangle A320541.  Hugo Pfoertner, Oct 22 2018
From Chai Wah Wu, Aug 18 2021: (Start)
Theorem: a(n) = n^2 + Sum_{i=2..n} (n+1i)*(2*n+2i)*phi(i)
Proof: Since gcd(n,n) = 1 if and only if n == 1, Sum_{i=1..n, j=1..n, gcd(i,j)=1} (n+1i)*(n+1j) = n^2 + Sum_{i=1..n, j=1..n, gcd(i,j)=1, (i,j) <> (1,1)} (n+1i)*(n+1j)
= n^2 + Sum_{i=2..n, j=1..i, gcd(i,j)=1} (n+1i)*(n+1j) + Sum_{j=2..n, i=1..j, gcd(i,j)=1} (n+1i)*(n+1j) = n^2 + 2*Sum_{i=2..n, j=1..i, gcd(i,j)=1} (n+1i)*(n+1j), i.e. the diagonal is not double counted.
This is equal to n^2 + 2*Sum_{i=2..n, j is a totative of i} (n+1i)*(n+1j). Since
Sum_{j is a totative of i} 1 = phi(i) and for i > 1, Sum_{j is a totative of i} j = i*phi(i)/2, the conclusion follows.
Similar argument holds for corresponding formulas for A088658, A114043, A114146, A115005, etc.
(End)


LINKS

Ray Chandler, Table of n, a(n) for n = 1..1000
M. Griffiths, Counting the regions in a regular drawing of K_{n,n}, J. Int. Seq. 13 (2010) # 10.8.5.
S. Legendre, The Number of Crossings in a Regular Drawing of the Complete Bipartite Graph , JIS 12 (2009) 09.5.5.
R. J. Mathar, Graphical representation among sequences closely related to this one (cf. N. J. A. Sloane, "Families of Essentially Identical Sequences").
N. J. A. Sloane, Families of Essentially Identical Sequences, Mar 24 2021 (Includes this sequence)
N. J. A. Sloane (in collaboration with Scott R. Shannon), Art and Sequences, Slides of guest lecture in Math 640, Rutgers Univ., Feb 8, 2020. Mentions this sequence.


FORMULA

a(n) = Sum_{i=1..n, j=1..n, gcd(i,j)=1} (n+1i)*(n+1j).
As n > oo, a(n) ~ (3/2)*n^4/Pi^2. This follows from Max Alekseyev's formula in A114043.  N. J. A. Sloane, Jul 03 2020.
a(n) = n^2 + Sum_{i=2..n} (n+1i)*(2n+2i)*phi(i).  Chai Wah Wu, Aug 15 2021


MAPLE

A115004 := 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+1a)*(n+1b);
end if;
end do:
end do:
r ;
end proc:
seq(A115004(n), n=1..30); # R. J. Mathar, Jul 20 2017


MATHEMATICA

a[n_] := Sum[(ni+1) (nj+1) Boole[GCD[i, j] == 1], {i, n}, {j, n}];
Array[a, 40] (* JeanFrançois Alcover, Mar 23 2020 *)


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
print([a115004(n) for n in range(1, 51)]) # Indranil Ghosh, Jul 21 2017
(Python)
from sympy import totient
def A115004(n): return n**2 + sum(totient(i)*(n+1i)*(2*n+2i) for i in range(2, n+1)) # Chai Wah Wu, Aug 15 2021


CROSSREFS

Cf. A320540, A320541, A320544.
The following eight sequences are all essentially the same. The simplest is the present sequence, A115004(n), which we denote by z(n). Then A088658(n) = 4*z(n1); A114043(n) = 2*z(n1)+2*n^22*n+1; A114146(n) = 2*A114043(n); A115005(n) = z(n1)+n*(n1); A141255(n) = 2*z(n1)+2*n*(n1); A290131(n) = z(n1)+(n1)^2; A306302(n) = z(n)+n^2+2*n.  N. J. A. Sloane, Feb 04 2020
Main diagonal of array in A114999.
Sequence in context: A240707 A115293 A212579 * A303522 A299261 A005338
Adjacent sequences: A115001 A115002 A115003 * A115005 A115006 A115007


KEYWORD

nonn,nice


AUTHOR

N. J. A. Sloane, Feb 23 2006


STATUS

approved



