Goldbach's comet: Difference between revisions

m
Line 383:
---
 
For G(1e6) that brute force approach becomes inefficient -- instead of about 2000 sums, almost 600 of which are relevant, we would need to find over 6e9 sums, mostand about 6e9 of whichthem would be irrelevant.
 
Instead, for G(1e6), we find all primes less than a million, subtract each from 1 million and count how many of the differences are prime and cut that in half. We cut that sum in half because this approach counts each pair twice (once with the smallest value first, again with the smallest value second). Since 1e6 is not the square of a prime we do not have a prime which appears twice in one of these sums.
6,951

edits