check if prime first