Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

Given a natural number **N**, the task is to find the sum of the divisors of all the divisors of N.

**Example 1:**

**Input:
**N = 54
**Output:
**232
**Explanation:
**Divisors of 54 = 1, 2, 3, 6, 9, 18, 27, 54.
Sum of divisors of 1, 2, 3, 6, 9, 18, 27, 54
are 1, 3, 4, 12, 13, 39, 40, 120 respectively.
Sum of divisors of all the divisors of 54
= 1 + 3 + 4 + 12 + 13 + 39 + 40 + 120 = 232.

**Example 2:**

**Input:
**N = 10
**Output:
**28
**Explanation:
**Divisors of 10 are 1, 2, 5, 10
Sums of divisors of all the divisors are
1, 3, 6, 18.
Overall sum = 1 + 3 + 6 + 18 = 28

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **sumOfDivisors()** which takes an integer N as an input parameter and return the sum of the divisors of all the divisors of N.

**Expected Time Complexity:** O(NloglogN)

**Expected Auxiliary Space:** O(N)

**Constraints:**

1 <= N <= 10^{4}

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Find sum of divisors

...