Update find prime algorithm.