Factoring Perfect Squares And Cubes