You are on page 1of 19

1

1
2 Journal of Integer Sequences, Vol. 4 (2001),
3
47 6
Article 01.2.2
23 11

The gcd-sum function

Kevin A. Broughan
University of Waikato, Hamilton, New Zealand
Email address: kab@waikato.ac.nz

Abstract
The gcd-sum is an arithmetic function
Pn defined as the sum of the gcds of the
first n integers with n : g(n) = i=1 (i, n). The function arises in deriving
asymptotic estimates for a lattice point counting problem. The function
is multiplicative, and has polynomial growth. Its Dirichlet series has a
compact representation in terms of the Riemann zeta function. Asymptotic
forms for values of partial sums of the Dirichlet series at real values are
derived, including estimates for error terms.
Keywords: greatest common divisor, Dirichlet series, lattice points, multi-
plicative, Riemann zeta function, gcd-sum.
MSC2000 11A05, 11A25, 11M06, 11N37, 11N56.

1. INTRODUCTION
Pn
This article is a study of the gcd-sum function: g(n) = i=1 (i, n). The
function arose in the context of a lattice point counting problem, for integer
coordinate points under the square root curve. The function is multiplica-
tive and has a derivative-like expression for its values at prime powers. The
growth function is O(n1+ ) and the corresponding Dirichlet series G(s) con-
verges at all points of the complex plane, except at the zeros of the Riemann
2

zeta function and the point s = 2, where it has a double pole. Asymptotic
expressions are derived for the partial sums of the Dirichlet series at all
real values of s.
These results may be compared with those of [3, 4, 5] where a different
arithmetic
Pn class of sums of the gcd are studied, namely those based on
g(n) = i,j=1 (i, j) and its generalizations. Note that the functions fail to
be multiplicative.
The original lattice point problem which motivated this work is solved
using a method based on that of Vinogradov. The result is then compared
with an expression found using the gcd-sum.

2. GCD-SUM FUNCTION
The gcd-sum is defined to be
n
X
g(n) = (j, n) (1)
j=1

The function that is needed in the application to counting lattice points,


described below, is the function S defined by
n
X
S(n) = (2j 1, n) (2)
j=1

Theorem 2.1. The function S and gcd-sum g are related by


g(n) n odd
S(n) = (3)
2g(n) 4g( n2 ) n even

Proof. For all n 1

n
X n
X 2n
X
(2j, n) + (2j 1, n) = (j, n) = 2g(n) (4)
j=1 j=1 j=1

If n is odd,
n
X n
X
(2j, n) = (j, n) = g(n)
j=1 j=1

From this and (4) we obtain the equation S(n) = g(n).


3

If n is even,
n n
X X n n
(2j, n) = 2 (j, ) = 4g( )
j=1 j=1
2 2

and again the result follows by (4).


The following theorem gives the value of g at prime powers. Even though
a direct proof is possible, we give a proof by induction since it reveals more
of the structure of the function.
Theorem 2.2. For every prime number p and positive integer 1:

g(p ) = ( + 1)p p1 (5)

Proof. When = 1:

g(p) = (1, p) + (2, p) + + (p, p) = (p 1) + p = 2p 1

Similarly when = 2:

g(p2 ) = (1, p2 ) + (2, p2 ) + + (p, p2 ) + (p + 1, p2 ) + + (2p, p2 ) + + (p2 , p2 )


= 1 + 1 + p + 1 + + p + + p2
= (p2 p) + p(p 1) + p2
= 3p2 2p

Hence the result is true for = 1 and for = 2. Now for any 2:
1
pX pX 1

g(p ) = (j, p ) + (j, p ) + p
j=1 j=p1 +1

pX 1
1
= g(p )+p + (j, p 1)
j=p1 +1

But

pX 1 p p 1
X 1

(j, p 1) = (j, p1 )
j=p 1+1 j=1
1
p p
X
= (j, p1 ) p1
j=1

= (p 1)g(p1 ) p1
4

Hence
g(p ) = p p1 + pg(p1 )
Thus, if we assume for some that

g(p ) = ( + 1)p p1 ,

then

g(p+1 ) = p+1 p + pg(p )


= p+1 p + p ( + 1)p + p1
 

= ( + 2)p+1 ( + 1)p

and the result follows by induction.

Theorem 2.3. The following expression gives the function g in terms


of Eulers totient function :
n
X X (d)
g(n) = (j, n) = n (6)
j=1
d
d|n

Proof. The integer e is equal to the greatest common divisor (j, n) if


and only if e|n and e|j and ( je , ne ) = 1 for 1 j n. Therefore the terms
with (j, n) = e are ( ne ) in number. Grouping terms in the sum for g(n)
with value e together, it follows that

X n X (d) X (d)
g(n) = e( ) = =n
e d/n d
e|n d|n d|n

Corollary 2.1. The function g is multiplicative, being the divisor sum


of a multiplicative function.

Note that g is not completely multiplicative, nor does it satisfy any


modular style of identity of the form
X mn
g(n)g(m) = h(d)g( 2 )
d
d|(m,n)

3. BOUNDS
5

Theorem 3.1. The function g is bounded above and below by the ex-
pressions
1  3 (n) g(n)  log n (n)
max(2 , ) 27
n 2 n (n)
where n is any positive integer and (n) is the number of distinct prime
numbers dividing n.

Proof. The bound


n
X
g(n) = (j, n) 1(n 1) + n = 2n 1
j=1

gives the lower bound


1 g(n)
2
n n
Now consider
g(n) Y g(p )
= (by 2.1)
n p
p|n
Y 
= ( + 1) (Theorem 2.2)
p
p|n
Y 1  3 (n)
(2 ) since 1 and p 2.
p 2
p|n

This completes the derivation of the second part of the lower bound.
By equation (5),

g(p ) 1
= (1 ) + 1 w log p
p p
where w Q
= 3 if p = 2, 3, 5 or w = 1 if p 7. Hence, if pi 7 for every i
and n = m i
i=1 pi , then

m m
g(n) Y Y
i log pi = log(p
i )
i

n i=1 i=1

Now
m
X
log n = i log pi
i=1
6

Qm
If f is the monomial function
P f (x) = i=1 xi of real variables subject to
the constraints xi 1 and xi = , for some fixed positive real number
m
, then (using Lagrange multipliers) the maximum value of f is ( m ) and

occurs where each xi = m . Hence

g(n) log n m log n (n)


=
n m (n)
In general, using 1 = 1 if 2 n, etc.,

g(n) Y
27(1 log p1 )(2 log p2 )(3 log p3 ) i log pi
n
pi 7
m
Y
= 27 i log pi
i=1
log n (n)
27
(n)

The upper bound in the expression given by the previous theorem is not
very useful, given the extreme variability of (n). A plot of the first 200
values of g(n)/n given in Figure 1 illustrates this variability. The following
estimates are more useful in practice.

Theorem 3.2. The functions g and S satisfy for all  > 0

g(n) = O(n1+ ) (7)


S(n) = O(n1+ ). (7)

Proof. This follows immediately from Theorem 2.3, since (d) d and
the divisor function d(n) = O(n ).

4. DIRICHLET SERIES
Define a Dirichlet series based on the function g:

X g(n)
G(s) = , for = <(s) > 2
n=1
ns
7

20
17.5
15
12.5
10
7.5
5
2.5

25 50 75 100 125 150 175 200

FIG. 1. The functions g(n)/n and n

Theorem 4.1. The Dirichlet series for G(s) converges absolutely for
> 2 and has an analytic continuation to a meromorphic function defined
on the whole of the complex plane with value

(s 1)2
G(s) =
(s)

where (s) is the Riemann zeta function.

Proof. First write g as a Dirichlet product:


X n
g(n) = (d) = ( g)(n)
d
d|n

Hence, if > 2,

X (n)  X n 
G(s) =
n=1
ns n=1
ns

X (n) 
= (s 1)
n=1
ns

But [1]
X n
(n) = (d)
d
d|n
8

Therefore

X (n) 
G(s) = (s 1)2
n=1
ns
(s 1)2
=
(s)

Since the right hand side is valid on the whole of the complex plane, G(s)
has the claimed analytic continuation with a double pole at s = 2 and a pole
at every zero of (s).
We now derive asymptotic expressions for the partial sums of this Dirich-
let series of g by a method which employs good expressions for Dirichlet
series based on Eulers function , leading to an improvement in the error
terms.
If , define the partial sum function G by


X g(n)
G (x) =
n
nx

f ( nx ) = O(x).
P
Lemma 4.1. If f (x) = O(log x) then nx

Proof. This follows easily from the estimate

log(bxc!) = x log x x + O(log x)

In what follows we define the constant function h (x) = for each real
number .
Theorem 4.2. As x

x log x
G1 (x) = + O(x)
(2)

Proof. By Theorem 2.3, if f (n) = (n)/n,

g(n) X (d)
=
n d
d|n

= (h1 f )(n)
9

P
If we define F (x) = nx f (n) then, by [1],

x
F (x) = + O(log x)
(2)

Therefore (using Lemma 5.1 to derive the error estimate)


X x
G1 (x) = h1 (n)F ( )
n
nx
X x
= F( )
n
nx
x 1 1 1
= [1 + + + + ] + O(x)
(2) 2 3 bxc
x 1
= [log x + + O( )] + O(x)
(2) x
x log x
= + O(x)
(2)

Theorem 4.3. As x ,

x2 log x
G0 (x) = + O(x2 )
2(2)

Proof. By Theorem 2.3 with f (n) = n:


Xn
g(n) = (d)
d
d|n

= (f )(n)
= ( f )(n)

P
If we define F (x) = nx n then

bxc(bxc + 1) x2
F (x) = = + O(x)
2 2
10

Therefore
X x
G0 (x) = (n)F ( )
n
nx

x2 X (n)
= + O(x2 )
2 n2
nx
2
x log x
= + O(x2 )
2(2)

Lemma 4.2. For all 

X x
G (x) = n1 ( )
n
nx

where
X (n)
(x) =
n
nx

Proof. Define the monomial function m (x) = x for all real and
positive x. By Theorem 2.3,

g(n) X (d) n
= ( )1
n d d
d|n

= ( m1 )(n)

The lemma follows directly from this expression.


Below we derive an asymptotic expression for G for all real values of
. This is interesting because of the uniform applicability of the same
expression. First we set out some standard estimates [1] which are collected
together below for easy reference. Let
X 1
S (x) =
n
nx

for all positive x and real . Then


11

x2
(a) 0 (x) = + O(x log x)
2(2)
x
(b) 1 (x) = + O(log x)
(2)
log x log x
(c) 2 (x) = + A + O( )
(2) (2) x
x2 ( 1)
(d) (x) = + + O(x1 log x), > 1, 6= 2
(2 )(2) ()
x2
(e) (x) = + O(x1 log x), 1
(2 )(2)
1
(A) S1 (x) = log x + + O( )
x
x1 1
(B) S (x) = + () + O( ), > 0, 6= 1
1 x
x1 1
(C) S (x) = + O( ), 0
1 x

where in (c)

X (n) log n
A= 0.35
n=1
n2 

Note that there are better estimates for the error terms, for
2 2 4
(a) O(x log 3 x(log log x)1+ ) [8] and for (b) O(log 3 x(log log x) 3 ) [9] but,
since these are only available for = 0 and = 1 we do not use them.
Even though there is a wide diversity of expressions in this set, a very
similar expression holds for G (x), for all real values of , except = 2
which corresponds to the pole of G(s):
Theorem 4.4. If < 2:

x2 log x
G (x) = + O(x2 ),
(2 )(2)
if = 2:
log2 x
G2 (x) = + O(log x)
2(2)
and if > 2:

x2 log x ( 1)2
G (x) = + + O(x2 ).
(2 )(2) ()
12

Proof.
Case 0: Let = 0. The stated result is given by Theorem 5.4 above.
Case 1: Let = 1. The result is given by Theorem 5.3.
Case 2: Let = 2.

X x
G2 (x) = n1 2 ( )
n
nx
X log( x ) X X log( nx ) 
= n
+( A) n1 + O n1
n(2) (2) x/n
nx nx nx
log x X 1 1 X log n X 1
= ( ) +( A)( ) + O(1)
(2) n (2) n (2) n
nx nx nx

log x 1 1 log2 x log x


= [ + A][log x + + O( )] [ + A1 + O( )] + O(1)
(2) (2) x (2) 2 x
log2 x 2
= + log x[ A] + O(1)
2(2) (2)

Case 3: If < 1 we have

X 1 x
G (x) = ( )
n1 n
nx
X 1 x2 X x 
= 1 2
+ O x1 log( )
n n (2 )(2) n
nx nx
2
x X 1
= ( ) + O(x2 )
(2 )(2) n
nx
2
x 1
= [log x + + O( )] + O(x2 )
(2 )(2) x
x2 log x
= + O(x2 )
(2 )(2)
13

Case 4: Finally, if > 1 and 6= 2:


X 1 x
G (x) = ( )
n1 n
nx
X 1  x2 ( 1) x1 x 
= + + O( 1 log( ))
n1 n2 (2 )(2) () n n
nx

x2 X1 ( 1) X 1
= ( )+ ( ) + O(x2 )
(2 )(2) n () n1
nx nx

x2 1
= [log x + + O( )]
(2 )(2) x
( 1) x2
+ [ + ( 1) + O(x1 )] + O(x2 )
() 2
x2 log x ( 1)2
= + + O(x2 )
(2 )(2) ()

For {0, 1, 2} we can improve these asymptotic expressions by deriving


an additional term and a smaller error. This has already been done for
= 2. In both of the remaining cases we use the P following useful, and
again
P elementary, device [1]: If ab = x, F (x) = nx f (n) and H(x) =
nx h(n) then
X X x X x
f (e)h(d) = f (n)H( ) + h(n)F ( ) F (a)H(b)
n n
e,dx na nb

in the special case a = b = x.
Theorem 4.5.
x log x 2 1
G1 (x) = + x[ A ] + O( x log x)
(2) (2) (2)

Proof. First rewrite G1 (x):


X x
G1 (x) = 1 ( ) (by Lemma 4.2)
n
nx
X X (n)
=
n
nx mx/n
X (d)
= 1.
d
e,dx
14

Now let F and H be defined by

X (n) x
F (x) = = + O(log x)
n (2)
nx
X
H(x) = 1 = bxc
nx

Using the device described above, rewrite G1 in terms of F and H:

X (n) x X x
G1 (x) = H( ) + F ( ) F ( x)H( x)
n n n
n x n x
X (n) x X x x
= [ + O(1)] + [ + O(log( ))]
n n n(2) n
n x n x

x
( + O(log(x)))( x + O(1))
(2)
X (n) X (n) x X 1
= x 2
+ O( )+
n n (2) n
n x n x n x
X x
+O( x log x) + O( log n) + O( x log x)
(2)
n x

log x log(x)
= x[ + A + O( ] + O( x)
2(2) (2) x
x 1
+ [log b xc + + O( )]
(2) x
x
+O( x log x) + O(log[ x]!)
(2)
x log x 2 1
= + x[ A ] + O( x log x).
(2) (2) (2)

Theorem 4.6.

log2 x 2
G2 (x) = + log x[ A] + O(1)
2(2) (2)

Proof. See the proof of Theorem 5.4, case 2 above.


15

Theorem 4.7.

x2 log x x2 (2)2
G0 (x) = + + O(x3/2 log x)
2(2) 2(3)

Proof. First we state four estimates:


X g(n) x log x
(1) G1 (x) = = + O(x) (Theorem 4.2)
n (2)
nx
X x2
(2) F (x) = n= + O(x)
2
nx
X
(3) log n = x log x + O(x)
nx

(2)2 log x
(4) G3 (x) = + O( ) (by Theorem 4.4)
(3) x

Expand G0 using f (n) = n and h(n) = g(n)/n so H = G1 :


X X g(n)
G0 (x) = g(n) = n
n
nx nx
X g(n) x X x
= F( ) + nG1 ( ) F ( x)G1 ( x)
n n n
n x n x
x
X g(n) x2 x X log nx x
= [ 2 + O( )] + n[ n + O( )]
n 2n n (2) n
n x n x

x x log x
( + O( x))( + O( x)) (by (1) and (2))
2 2(2)
2 X
x g(n) X g(n)  x log x X
= 3
+O + 1
2 n n2 (2)
n x n x n x
3/2
x X X x log x
log n + O(x 1) + O(x3/2 )
(2) 4(2)
n x n x
2
x x2 log x
= G3 ( x) + O(log2 x) + + O(x3/2 log x)
2 2(2)

x x log x x3/2 log x
[ + O( x)] + O(x3/2 ) + O(x3/2 ) (by (3))
(2) 2 4(2)
16

Therefore

x2 (2)2 log x x2 log x


G0 (x) = [ + O( )] +
2 (3) x 2(2)

x x log x
[ + O( x)]
(2) 2
x3/2 log x
+ O(x3/2 log x) (using (4))
4(2)
x2 log x x2 (2)2
= + + O(x3/2 log x)
2(2) 2(3)

5. APPLICATION
Consider the problem of counting the integer lattice points in the first
quadrant in the square [0, R] [0, R] and under the curve y = Rx as
R .
Let R = n2 and count lattice points by adding those in trapezia under
the curve. If T is a trapezium with integral coordinates for each vertex
(0, 0), (b, 0), (0, ), and (b, ), then by Picks theorem [6] the area is equal
to the number of interior points plus one half the number of interior points
on the edges plus one. From this it follows that the total number of interior
lattice points is given by the expression

1
[(b 1)( + ) b (b, ) + 2]
2

where (u, v) is the greatest common divisor.


We approximate the region under the curve y = n x and above the
interval [0, n2 ] by n trapezia with the j-th having the base [(j 1)2 , j 2 ].
Divide the lattice points inside and on the boundary of these trapezia into
five sets:

L1 = #{interior points of trapezia}


L2 = #{interior points of vertical sides}
L3 = #{interior points of the top sides}
L4 = #{interior points of the bottom sides}
L5 = #{vertices of all trapezia}
17

Then
n
X 1
L1 = [(2j 1)(nj + n(j 1)) (2j 1) n(j 1) nj (2j 1, n) + 2]
j=1
2
n1
X n3 n2
L2 = nj 1 = n+1
j=1
2 2
n
X
L3 = [(n, 2j 1) 1] = S(n) n where S is defined in (2)
j=1
Xn
L4 = 2j 2 = n2 n
j=1
L5 = 2n + 1

Hence if N1 (R) represents the total number of lattice points,

N1 (R) = L1 + L2 + L3 + L4 + L5
2 1 1
= n4 n2 + S(n)
3 6 2
2 1 1
N1 (n2 ) = n4 n2 + O(n 2 + )
3 6

by Theorem 3.2.
It is interesting to note that the area of the gap between the curve and
the trapezia is exactly 16 n2 .
The total number of points in the trapezia is of course less than the
number under the curve. There are n trapezia, the j-th having width
2j 1. The maximum distance from the top of the j-th trapezia to the
curve is n/4(2j 1), so the number of additional points is O(n2 ). This
leads to the estimate
2 4
N2 (n2 ) = n + O(n2 )
3
for the number N2 of lattice points under the curve.
Now a more accurate estimate for N2 is derived. First the method of
Vinogradov [7] is used to count the fractional parts of the inverse function
x = y 2 /R:
Let b a  A where A  1. Let f be a function defined on the positive
real numbers with f 00 continuous, 0 < f 0 (x)  1 and having f 00 (x)  A1 .
Then
18

X ba 2
{f (u)} = + O(A 3 )
2
a<ub

If A = n, f (u) = u2 /n, and f 00 (u) = 2/n  A1 then it follows that


X n 2
{f (u)} = + O(n 3 )
2
0<un

Hence the number of lattice points M (n) under or on the inverse function
curve is
n
X  j2 
M (n) = +n+1
j=1
n
n n
X j 2 X j 2
= +n+1
j=1
n j=1
n
1 n 2
= (n + 1)(2n + 1) + + O(n 3 )
6 2

So if N2
(n) represents the number of lattice points strictly under the
curve y = Rx when R = n, then

1 n 2
N2 (n) = (n + 1)2 (n + 1)(2n + 1) + O(n 3 )
6 2
2 2
= n2 + n + O(n 3 )
3

1
The number of lattice points on the curve is O(n 2 ), so does not change
this estimate.

ACKNOWLEDGMENT
This work was done in part while the author was on study leave at Columbia Univer-
sity. The support of the Department of Mathematics at Columbia University and the
valuable discussions held with Patrick Gallagher are warmly acknowledged.

REFERENCES
1. Apostol, T.M. Introduction to Analytic Number Theory. New York, Berlin Heidel-
berg: Springer-Verlag, 1976.
19

2. Apostol, T.M. Modular Functions and Dirichlet Series in Number Theory, Second
Edition. New York, Berlin, Heidelberg: Springer-Verlag, 1990.
3. Cohen, E. Arithmetical functions of greatest common divisor. I., Proc. Amer. Math.
Soc. 11 (1960), 164-171.
4. Cohen, E. Arithmetical functions of greatest common divisor. II. An alternative
approach., Boll. Un. Mat. Ital. (3) 17, (1962), 349-356.
5. Cohen, E Arithmetical functions of greatest common divisor. III. Cesaros divisor
problem, Proc. Glasgow Math. Assoc. 5, (1961), 67-75.
6. Coxeter, H.S.M. Introduction to Geometry, New York, Wiley, 1969.
7. Karatsuba, A.A. Basic Analytic Number Theory. New York, Berlin, Heidelberg:
Springer-Verlag, 1993.
8. Szaltiikov, A.I. On Eulers function Mat. Sb. 6 (1960), 34-50.
9. Walfisz, A. Weylsche Exponentialsummen in der neueren Zahlentheorie, Berlin,
1963.

(Concerned with sequence A018804.)

Received April 2, 2001. Revised version received July 19, 2001. Published in
Journal of Integer Sequences, Oct 25, 2001.

Return to Journal of Integer Sequences home page.

You might also like