Added primality test and fixed pollard rho algo