Problem 60953. Chek the Delta = p' - p = 6k gap theorem about arithmetic progressions in the prime number set
Context
In the prime numbers set there are some arithmetic progressions (sequences of three or more consecutive prime numbers (p, p’, p’’) equally spaced one to the others by an even number
).
One theorem, which can actually easily be proven from
, is that above the sole and unique triplet (3, 5, 7) -with a gap of
then- all the following progressions are such that 
Problem statement
For a given interval [i1, i2], i1 > 7 and i2 > 7 find p the first corresponding arithmetic progression (3 or more consecutive consecutive primes equally spaced) in this interval and check the conjecture equation simply by calculating the integer ratio
.
Examples
- For [i1, i2] = [8, 68], p = [47, 53, 59] and k = [1, 1], since this is the first arithmetic progression above 8 and with
here;
- For [i1, i2] = [180, 228], p = [199, 211, 223], and k = [2, 2], since this is the first arithmetic progression above 180 and with
here;
- For [i1, i2] = [240, 272], p = [251, 257, 263, 269], and k = [1, 1, 1], since this is the first arithmetic progression above 140 and with
here;
- For [i1, i2] = [180, 272], p = [199, 211, 223], and k = [2, 2], since this is the first arithmetic progression above 180 and with
here;
Tip
First maybe, train yourself to find the first and last indices of zeros of a first block of consecutive zeros in a vector of integers, eg for u = [1 0 0 0 1 1 0 0 1], j1 = 2 and j2 = 4.
Forbidden functions
- regexp
- str2num
- assignin
- echo
See also
Solution Stats
Problem Comments
-
2 Comments
Matthew
on 10 Jul 2025
Challenging problem, generalizing the indexing took a bit of thinking.
Nicolas Douillet
on 11 Jul 2025
Thank you Matthew. It took me also some time to create and write this problem, as well as to figure out its solution.
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
Chek the Delta = p' - p = 6k gap theorem about arithmetic progressions in the prime number set
11 Solvers
More from this Author42
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!