A factorization algorithm for G-algebras and its applications. (March 2018)