def prime_sum_v1(h_E,M):
    """
    Returns the sum of h_E(p) over all primes p<M.
    """
    y,n = float(0),int(1)
    while n < M:
        if is_prime(n):
            y += h_E(n)
        n += 1
    return y