add prime algorithm