Given three integers A, B, C, the task is to find
ΣAi=1 ΣBj=1ΣCk=1 d(i.j.k), where d(x) is the number of divisors of x. Answer can be very large, So, print answer modulo 109+7.
Input: A = 2, B = 2, c = 2 Output: 20 Explanation: d(1.1.1) = d(1) = 1; d(1·1·2) = d(2) = 2; d(1·2·1) = d(2) = 2; d(1·2·2) = d(4) = 3; d(2·1·1) = d(2) = 2; d(2·1·2) = d(4) = 3; d(2·2·1) = d(4) = 3; d(2·2·2) = d(8) = 4. Input: A = 5, B = 6, C = 7 Output: 1520
- Find the number of divisors of all numbers in the range [1, N]
- Run three nested loops with iterators i, j, k staring from 1 to N
- Then find d(i.j.k) using pre computed number of divisors.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Find sum of inverse of the divisors when sum of divisors and the number is given
- Find sum of divisors of all the divisors of a natural number
- Find number from its divisors
- Find the largest good number in the divisors of given number N
- Find the number of integers x in range (1,N) for which x and x+1 have same number of divisors
- Find all divisors of a natural number | Set 1
- Find all divisors of a natural number | Set 2
- Find the number of divisors of all numbers in the range [1, n]
- Find the winner of the game based on greater number of divisors
- Program to find count of numbers having odd number of divisors in given range
- Querying maximum number of divisors that a number in a given range has
- Check if a number is divisible by all prime divisors of another number
- Find A and B from list of divisors
- First triangular number whose number of divisors exceeds N
- Find all divisors of first N natural numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.