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

78.95% Correct | 21.05% Incorrect
Last Solution submitted on Aug 18, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers11

Suggested Problems

More from this Author42

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!