I didn't know there was a formula

i = 1 k gcd ( i , k ) = ? \large \sum_{i=1}^{k}\gcd(i,k) = \ ? Let's represent k N k \in \mathbb{N} with its prime factorization, i.e., k = i = 1 n p i a i \displaystyle k=\prod_{i=1}^{n} {p_i}^{a_i} , where n n is the number of distinct primes that divide k k . Find the value of the above sum.

i = 1 n p i a i 1 ( a i + 1 ) ( p i 1 ) \prod_{i=1}^{n} {p_i}^{a_i-1}(a_i+1)(p_i-1) k i = 1 n ( 1 + ( a i + 1 ) ( p i + 1 ) ) k \prod_{i=1}^{n}\left(1+(a_i+1)(p_i+1)\right) k i = 1 n ( 1 + ( a i + 1 ) ( p i 1 ) ) k \prod_{i=1}^{n} \left(1+(a_i+1)(p_i-1)\right) i = 1 n p i a i 1 ( 1 + ( a i + 1 ) ( p i 1 ) ) \prod_{i=1}^{n}{p_i}^{a_i-1}\left(1+(a_i+1)(p_i-1)\right) i = 1 n p i a i 1 ( 1 + ( a i + 1 ) ( p i + 1 ) ) \prod_{i=1}^{n}{p_i}^{a_i-1}\left(1+(a_i+1)(p_i+1)\right) k i = 1 n ( a i + 1 ) ( p i 1 ) k \prod_{i=1}^{n} (a_i+1)(p_i-1)

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

We know that if d k d \mid k and gcd ( q , k d ) = 1 \gcd\left(q,\dfrac{k}{d}\right)=1 where 1 q k d 1 \leq q \leq \dfrac{k}{d} , then gcd ( d q , k ) = d \gcd(dq,k)=d . From the restriction we clearly see that 1 d q k 1 \leq dq \leq k .

For example, if k = 30 k=30 and d = 3 d=3 , all the possible values for q q are 1 , 3 , 7 , 9 1,3,7,9 , so gcd ( 3 , 30 ) = gcd ( 9 , 30 ) = gcd ( 21 , 30 ) = gcd ( 27 , 30 ) = 3 \gcd(3,30)=\gcd(9,30)=\gcd(21,30)=\gcd(27,30)=3 . What does it tell us? That there will be exactly four values of i i for which gcd ( i , 30 ) = 3 \gcd(i,30)=3 and 1 i 30 1 \leq i \leq 30 .

Note that we need q q to be coprime with k d \dfrac{k}{d} , and since q k d q \leq \dfrac{k}{d} , the number of values of q q will be φ ( k d ) \varphi\left(\dfrac{k}{d}\right) . So, there will be exactly φ ( k d ) \varphi\left(\dfrac{k}{d}\right) values of i i for which gcd ( i , k ) = d \gcd(i,k)=d and 1 i k 1 \leq i \leq k .

And since gcd ( i , k ) \gcd(i,k) is always a divisor of k k , the sum we want is f ( k ) = d k φ ( k d ) d \displaystyle f(k)=\sum_{d \mid k} \varphi\left(\dfrac{k}{d}\right) d , i.e., we run over all positive divisors d d of k k to find how many times d d will be the result of gcd ( i , k ) \gcd(i,k) ; and we sum this for all d d .

So, f ( k ) = φ I f(k)=\varphi * I . Since I I and φ \varphi are multiplicative functions, f ( k ) f(k) is also multiplicative. That means that we only need to find what is f f evaluated at some prime power, i.e., f ( p a ) f(p^a) . We have: f ( p a ) = d p a φ ( d ) p a d = j = 0 a φ ( p j ) p a p j = p a j = 0 a φ ( p j ) p j = p a ( 1 + j = 1 a φ ( p j ) p j ) = p a ( 1 + j = 1 a ( 1 1 p ) ) = p a ( 1 + a ( 1 1 p ) ) = p a 1 ( p + a ( p 1 ) ) = p a 1 ( 1 + p 1 + a ( p 1 ) ) = p a 1 ( 1 + ( a + 1 ) ( p 1 ) ) \begin{aligned} f(p^a) &= \sum_{d \mid p^a} \varphi(d) \dfrac{p^a}{d}\\ &= \sum_{j=0}^{a} \varphi(p^j) \dfrac{p^a}{p^j}\\ &= p^a \sum_{j=0}^{a} \dfrac{\varphi(p^j)}{p^j}\\ &= p^a \left(1+\sum_{j=1}^{a} \dfrac{\varphi(p^j)}{p^j}\right)\\ &= p^a \left(1+\sum_{j=1}^{a} \left(1-\dfrac{1}{p}\right)\right)\\ &= p^a \left(1+a\left(1-\dfrac{1}{p}\right)\right)\\ &= p^{a-1} \left(p+a(p-1)\right)\\ &= p^{a-1} \left(1+p-1+a(p-1)\right)\\ &= p^{a-1} \left(1+(a+1)(p-1)\right) \end{aligned} Finally, f ( k ) = f ( i = 1 n p i a i ) = i = 1 n f ( p i a i ) = i = 1 n p i a i 1 ( 1 + ( a i + 1 ) ( p i 1 ) ) \displaystyle f(k)=f\left(\prod_{i=1}^{n} {p_i}^{a_i}\right)=\prod_{i=1}^{n} f({p_i}^{a_i})=\boxed{\prod_{i=1}^{n} {p_i}^{a_i-1} \left(1+(a_i+1)(p_i-1)\right)} .

Sándor Daróczi
Jul 19, 2017

Let f ( k ) = i = 1 k gcd ( i , k ) f(k) = \displaystyle \sum_{i=1}^k \gcd(i,k) for any k k positive integer.

We are going to prove the two statements below, from which the answer clearly follows:

Claim 1.: If p p is a positive prime and a a is an arbitrary positive integer, f ( p a ) = p a 1 ( 1 + ( a + 1 ) ( p 1 ) ) f(p^a) = p^{a-1}(1+(a+1)(p-1)) .

Claim 2.: f ( k ) f(k) is a multiplicative arithmetic function, which means that if gcd ( a , b ) = 1 \gcd(a,b) = 1 for a , b a, b positive integers, then f ( a b ) = f ( a ) f ( b ) f(ab) = f(a)f(b) .

Proof of Claim 1.:

We are using induction on a a . The base case a = 1 a=1 is clear, since f ( p ) = ( i = 1 p 1 gcd ( i , p ) ) + gcd ( p , p ) = p 1 + p = 2 p 1 f(p) = (\displaystyle \sum_{i=1}^{p-1} \gcd(i,p)) + \gcd(p,p) = p-1 + p = 2p-1 and p a 1 ( 1 + ( a + 1 ) ( p 1 ) ) = 2 p 1 p^{a-1}(1+(a+1)(p-1)) = 2p-1 .

Assume that the claim is proven for a 1 a-1 . In order to verify it for a a , recall the following well known facts:

  1. gcd ( a + k b , b ) = gcd ( a , b ) \gcd(a+kb,b) = \gcd(a,b) for any a a , b b , k ,k integers.

  2. If 0 < i < p a 0<i<p^a , gcd ( i , p a ) = gcd ( i , p a 1 ) \gcd(i,p^a) = \gcd(i,p^{a-1}) for a p p prime and an a a positive integer.

Using this we can now establish the induction step for a a :

f ( p a ) = i = 1 p a gcd ( i , p a ) = i = 1 p a 1 1 gcd ( i , p a ) + gcd ( p a 1 , p a ) + i = 1 p a 1 1 gcd ( i + p a 1 , p a ) + gcd ( 2 p a 1 , p a ) + + i = 1 p a 1 1 gcd ( i + ( p 1 ) p a 1 , p a ) + gcd ( p a , p a ) = i = 1 p a 1 1 ( j = 0 p 1 gcd ( i + j p a 1 , p a ) ) + l = 1 p gcd ( l p a 1 , p a ) = i = 1 p a 1 1 ( j = 0 p 1 gcd ( i + j p a 1 , p a 1 ) ) + ( p 1 ) p a 1 + p a = i = 1 p a 1 1 ( j = 0 p 1 gcd ( i , p a 1 ) ) + ( 2 p 1 ) p a 1 = i = 1 p a 1 1 p gcd ( i , p a 1 ) + ( 2 p 1 ) p a 1 = p ( f ( p a 1 ) p a 1 ) + ( 2 p 1 ) p a 1 = p a 1 ( 1 + a ( p 1 ) ) p a + ( 2 p 1 ) p a 1 = p a 1 ( 1 + a p a p + 2 p 1 ) = p a 1 ( 1 + ( a + 1 ) ( p 1 ) ) f(p^a) = \displaystyle \sum_{i=1}^{p^a} \gcd(i,p^a) = \displaystyle \sum_{i=1}^{p^{a-1}-1} \gcd(i,p^a) + \gcd(p^{a-1}, p^a) + \displaystyle \sum_{i=1}^{p^{a-1}-1} \gcd(i+p^{a-1},p^a) + \gcd(2p^{a-1}, p^a) + \ldots + \displaystyle \sum_{i=1}^{p^{a-1}-1} \gcd(i+(p-1)p^{a-1},p^a) + \gcd(p^a, p^a) = \displaystyle \sum_{i=1}^{p^{a-1}-1} (\displaystyle \sum_{j=0}^{p-1} \gcd(i+jp^{a-1},p^a)) + \displaystyle \sum_{l=1}^{p} \gcd(lp^{a-1},p^a) = \displaystyle \sum_{i=1}^{p^{a-1}-1} (\displaystyle \sum_{j=0}^{p-1} \gcd(i+jp^{a-1},p^{a-1})) + (p-1)p^{a-1}+p^a = \displaystyle \sum_{i=1}^{p^{a-1}-1} (\displaystyle \sum_{j=0}^{p-1} \gcd(i,p^{a-1})) + (2p-1)p^{a-1} = \displaystyle \sum_{i=1}^{p^{a-1}-1} p \cdot \gcd(i,p^{a-1}) + (2p-1)p^{a-1} = p \cdot (f(p^{a-1}) - p^{a-1}) + (2p-1)p^{a-1} = p^{a-1}(1+a(p-1)) - p^a + (2p-1)p^{a-1} = p^{a-1}(1+ap-a-p+2p-1) = p^{a-1}(1+(a+1)(p-1)) ,

so our induction is complete.

Proof of Claim 2.:

The greatest common divisor function is known to be multiplicative, so for every a a , b b , i i integers we have gcd ( i , a b ) = ( gcd ( i , a ) ) ( gcd ( i , b ) ) \gcd(i,ab) = (\gcd(i,a))(\gcd(i,b)) .

Furthermore, according to the Chinese Remainder theorem for every 0 i a 1 0 \leq i \leq a-1 and 0 j b 1 0 \leq j \leq b-1 pair of integers there is exactly one number u ( i , j ) u(i,j) in the interval ( 1 , a b ) (1,ab) which has a remainder of i i and j j when divided by a a and b b respectively.

Using the former observations we obtain the following:

f ( a b ) = i = 1 a b gcd ( i , a b ) = i = 0 a 1 j = 0 b 1 gcd ( u ( i , j ) , a b ) = i = 0 a 1 j = 0 b 1 ( gcd ( u ( i , j ) , a ) ) ( gcd ( u ( i , j ) , b ) ) = i = 0 a 1 j = 0 b 1 ( gcd ( i , a ) ) ( gcd ( j , b ) ) = i = 1 a j = 1 b ( gcd ( i , a ) ) ( gcd ( j , b ) ) = ( i = 1 a gcd ( i , a ) ) ( j = 1 b gcd ( j , b ) ) = f ( a ) f ( b ) f(ab) = \displaystyle \sum_{i=1}^{ab} \gcd(i,ab) = \displaystyle \sum_{i=0}^{a-1} \displaystyle \sum_{j=0}^{b-1} \gcd(u(i,j),ab) = \displaystyle \sum_{i=0}^{a-1} \displaystyle \sum_{j=0}^{b-1} (\gcd(u(i,j),a))(\gcd(u(i,j),b)) = \displaystyle \sum_{i=0}^{a-1} \displaystyle \sum_{j=0}^{b-1} (\gcd(i,a))(\gcd(j,b)) = \displaystyle \sum_{i=1}^{a} \displaystyle \sum_{j=1}^{b} (\gcd(i,a))(\gcd(j,b)) = (\displaystyle \sum_{i=1}^{a} \gcd(i,a))(\displaystyle \sum_{j=1}^{b} \gcd(j,b)) = f(a)f(b)

Q.E.D.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...