Help in number theory

Revision en2, by LIFE_GOES_ON, 2020-07-08 23:12:27

In this 615D - Множители after analyzing some cases, I saw that,

If a number n = p1^a * p2^b * p3^c.

Then for the answer the contribution of each prime is something like -

Let that , calculating the contribution of p1 --->

x = (a * (a+1) )/2;
y = (b+1)*(c+1) [ That is , how many divisors are there without the prime p1]

z = x*y
so the contribution of p1 is  p1^z

To calculate y , I had to use two loops. And got TLE[submission:https://codeforces.net/contest/615/submission/86303876]. How to optimize this portion?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English LIFE_GOES_ON 2020-07-08 23:18:11 3
en3 English LIFE_GOES_ON 2020-07-08 23:15:16 47
en2 English LIFE_GOES_ON 2020-07-08 23:12:27 9
en1 English LIFE_GOES_ON 2020-07-08 23:11:26 581 Initial revision (published)