from lib_prime import primes def euler_187(): r = 0 upper = 10**8 ps = primes(upper // 2) for i in range(len(ps)): for j in range(i, len(ps)): if ps[i] * ps[j] >= upper: break r += 1 return r if __name__ == "__main__": solution = euler_187() print("e187.py: " + str(solution)) assert(solution == 17427258)