>>14124497Yeah. You have to manipulate the initial formula except where the limit is 2000 and then subtract out all of those sums which include numbers greater than 1000. This is easy but I am not sure if there is a way to reach a nice formula as for each prime > 1000 is composite of 1000 + n where 2n is the number of pairs which include a number > 1000 and which could be subtracted off.
I thought about it a little more. Every prime number can be defined as (2000-k) so then the sum of primes is (2000-k1 + 2000-k2 + ... + 2000-km)
2000(P_c - (k1 + k2 + ... + km)/2000)
P_c is count of primes less than 2000.
I will call k the complement number used with a reference of 2000 in this case. Now you divide the k group into two primary sections, those less than 1000 and those greater than 1000. The ones greater are already the primes sums we have. Of the remainder k will be of the form 1000 - n, where 2n is the number of pairs we want to subtract. So we are taking a complement of k with respect to 1000.
(1000 - n_k1 + 1000 - n_k2 + ... + 1000 - n_kn)
All of this together gets this nasty little
I will have to write the program up to test it, the advantage here is because we are already looking at all of the primes, n can be found concurrently for those numbers greater than L which we are looking at. While n itself is defined for those primes > L, n = p - L