reworked prime method

Added prime module from std lib, over your code. simplified factor
finding.