Problem 42914. Counting the Grand Primes
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.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers47
Suggested Problems
-
All your base are belong to us
535 Solvers
-
5443 Solvers
-
105 Solvers
-
143 Solvers
-
303 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!