I was trying to calculate this for some integer *n* < = 10^{9} :

In other words summation of summation of ... (m times summations) of divisors of *n*.

If anyone can help me out with this!

Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | Radewoosh | 3443 |

2 | tourist | 3372 |

3 | OO0OOO00O0OOO0O0…O | 3264 |

4 | ksun48 | 3176 |

5 | scott_wu | 3168 |

6 | CongLingDanPaiSh…5 | 3157 |

7 | Benq | 3154 |

8 | Petr | 3139 |

9 | Um_nik | 3138 |

10 | LHiC | 3118 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 195 |

2 | Errichto | 175 |

3 | rng_58 | 158 |

4 | Ashishgup | 157 |

5 | neal | 156 |

6 | tourist | 154 |

7 | Petr | 151 |

7 | PikMike | 151 |

9 | Um_nik | 149 |

10 | kostka | 148 |

I was trying to calculate this for some integer *n* < = 10^{9} :

In other words summation of summation of ... (m times summations) of divisors of *n*.

If anyone can help me out with this!

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/15/2018 02:09:00 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Let's denote your summation by f(m,n).

First, prove that f(m,*) is multiplicative. This can be easily proved by induction, assuming f(m-1,*) are multiplicative, and obviously f(0,*) is 1, which is multiplicative.

Hence, factorise n into prime powers, and multiply the answers for individual prime powers.

So, now you only need to solve f(m,n) where n is of the form (p^a) where p is some prime.

Another observation tells you that p is irrelevant, only the value of 'a' matters, so let's call g(m,a) = f(m,p^a)

Writing the obvious recursion from g, by the given definition of f, we get

g(m,a) = g(m-1,0) + g(m-1,1) + ... + g(m-1,a)

with base case g(0,x) = 1

We can see that this is equivalent to distributing 'a' objects in 'm+1' places, where the recursion for g indicates looping on number of objects in the 1st place.

So, g(m,a) = C(a+m,m)

I believe this solves your problem. I might have missed something here or there or maybe did some off by 1 error, but the basic idea is this only, you'll get a bunch of C(n,r) terms and the function is multiplicative.

Perfect!