Solve p010 using smallest prime factor rule