Question: How to construct a list of factors of a polynomial

Consider f is a polynomial which is constructed from some polynomials. In other words, f=g_1^{k_1}*g_2^{k_2}*...*g_n^{k_n} where  g_1,g_2,..,g_n are some polynomials and also  k_1,k_2,..,k_n are positive integer numbers.

My question: How to define a procedure such that the output of proc(f) is the following list [g_1 , g_2 , ... g_n]. In fact, the procedure separates the factors of the polynomial f into  a list and also removes the powers of the factors. 

For example, suppose that f=x*(x+1)^4*(x^2+x+1)*(x^3+x^2+1)^5. Then, the output of the proc(f) be as follows [x , x+1 , x^2+x+1 , x^3+x^2+1].

Thanks in advance

Please Wait...