Problem statement
Given a gap Δ= p' - p between the two consecutive prime numbers p and p', find its first occurence, f.
Examples
  • If , f=2, since 5 - 3 = 2, and 3 is the 2nd prime;
  • If , f=4, since 11 - 7 = 4, and 7 is the 4th prime;
  • If , f=9, since 29 - 23 = 6, and 23 is the 9th prime;
If Δ neither equals an even positive integer nor equals 1 your function should return the empty set : f = [];
See also

Solution Stats

88 Solutions

29 Solvers

Last Solution submitted on Nov 03, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers29

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!