fixed is_prime off by one bug