A grand prime pair is a pair of primes, p1 and p2=p1+1000, such that both numbers are prime. Like a twin prime pair, where the difference is 2, the members of a grand prime pair always have a difference of 1000. Some facts about grand prime pairs, so that you can test your code:
1. The smallest grand prime pair is [13,1013], the 100th such pair is [3229,4229].
2. There are 37 grand prime pairs such that the larger element of the pair is no larger than 2000.
3. There should be infinitely many grand prime pairs.
4. All such grand prime pairs must have the property that the smaller element of the pair is of the form 6*k+1, for some integer k.
Write a function that counts the number of grand prime pairs that exist, such that the larger element of the pair is no larger than N. I'll be nice and not ask you to compute that result for N too large, 1e8 seems a reasonable upper limit.
Number of 1s in the Binary Representation of a Number
403 Solvers
Increment a number, given its digits
611 Solvers
Reverse the Words (not letters) of a String
316 Solvers
Solve the set of simultaneous linear equations
229 Solvers
find the roots of a quadratic equation
152 Solvers