optimize prime