# Generating factors of a no from its prime factorisation

Hey, can anyone explain me how to generate factors of a no from its prime factorisation?
I have read the article on geeksforgeeks but it is not very clear to me.

https://cp-algorithms.com/algebra/divisors.html
Check it out . It might help .

This brings memory about class 12 maths. But this contains only no of divisors and its sum.

I think you had problem in recursion part. First we are calculating all the prime factors and its count and storing them in a vector. Now, we have to generate all the combinations of prime factors. We are simply first multiplying all prime factors one time then second time and till its no of count.

You may calculate in O(n) by simply iterating in loop

actually i was trying this problem in which it is required to find the factors of y^2 from its prime factorisation as stated in the editorial where I got stuck.

can you explain how can i do it iteratively?

For O(sqrt(n)), if n%i==0 then i and n/i both are divisors

you can find prime factorization of N in O(sqrt(N)).
Here is the video I made explaining this concept : - YouTube

here is the complete playlist for Number theory : null - YouTube

here is the video editorial I made for this video : - YouTube

see if you find this helpful