Pretty basic right? #2

The divisor function σ 0 ( n ) \sigma_0(n) counts the number of divisors of any integer n n . Evaluate the following sum i = 2 4 × 1 0 7 σ 0 ( i ) \large{\sum_{i=2}^{4\times10^7} \sigma_0(i)}


The answer is 706353001.

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.

3 solutions

Abhishek Sinha
Aug 2, 2015

Let N = 4 × 1 0 7 N=4\times 10^7 . By a simple double-counting argument, we have i = 2 N σ 0 ( i ) = ( i = 1 N N i ) 1 \sum_{i=2}^{N}\sigma_0(i)= \bigg(\sum_{i=1}^{N}\lfloor \frac{N}{i}\rfloor\bigg) -1 Details : We evaluate the sum by counting the number of multiples of a number i i upto the number N N . Clearly it has N i \lfloor \frac{N}{i} \rfloor multiples.

@Abhishek Sinha Great approach Sir! Sir, would it be possible for you to kindly prove your proposition? Many thanks Sir!

User 123 - 5 years, 9 months ago

a little more detail please!

Aarush Kumbhakern - 5 years, 10 months ago
Samarpit Swain
Aug 25, 2015

C++!

S o l u t i o n 1 : \mathbf{Solution 1 \; \; : }

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 #include <iostream>
using namespace std;

int main() {
 unsigned long int i,k,n,sum=0;
   for(unsigned long int x=2;x<=40000000;x++)
 { 
    n=x;
    k=0;
 for(i=1;i*i<n;i++)
   {  
     if(n%i==0)
      k++;
   }
     k=k*2;
     if(i*i==n)
      k++;
   sum+=k
 }
   cout<<sum; 
    return 0;
}

S o l u t i o n 2 : \mathbf{Solution 2 \; \; : }

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <iostream>
using namespace std;

int main() {

unsigned long int n,sum=0,t;

  for(unsigned long int x=1;x<=40000000;x++)
     { 
        t=(40000000/x);
     sum+=t;
             }
      cout<<sum-1;       
    return 0;
}

Out of these two programs I would prefer the second one. The first one takes a long time for compilation, whereas the second is short and sweet!

Bill Bell
Feb 15, 2016

Using PARI/GP where it would be better to use one's head.

1
2
3
4
5
6
7
(13:xx) gp > primelimit=10^8
%1 = 100000000
(13:xx) gp > total=0
%2 = 0
(13:xx) gp > for (i=2,4*10^7,total+=length(divisors(i)))
(13:xx) gp > print (total)
706353001

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...