Find the sum of the number of divisors |  ; To store the number of divisors ; Function to find the number of divisors of all numbers in the range 1 to n ; For every number 1 to n ; Increase divisors count for every number ; Function to find the sum of divisors ; To store sum ; Count the divisors ; Driver code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define N  100005 NEW_LINE #define mod  1000000007 NEW_LINE int cnt [ N ] ; void Divisors ( ) { memset ( cnt , 0 , sizeof cnt ) ; for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; j * i < N ; j ++ ) cnt [ i * j ] ++ ; } } int Sumofdivisors ( int A , int B , int C ) { int sum = 0 ; Divisors ( ) ; for ( int i = 1 ; i <= A ; i ++ ) { for ( int j = 1 ; j <= B ; j ++ ) { for ( int k = 1 ; k <= C ; k ++ ) { int x = i * j * k ; sum += cnt [ x ] ; if ( sum >= mod ) sum -= mod ; } } } return sum ; } int main ( ) { int A = 5 , B = 6 , C = 7 ; cout << Sumofdivisors ( A , B , C ) ; return 0 ; }