Problem statement
Given two positive integers n and Δ, write a function which computes the frequency of the gap Δ between two consecutive of the primes in the prime vector going from 2 to n.
Examples
  • For n = 100 and Δ= 2, your function should return f = 1/3 since one third of the prime gaps between 2 and 97 equal Δ;
  • For n = 1000 and Δ= 6, your function should return f = 44/167;
See also

Solution Stats

39 Solutions

26 Solvers

Last Solution submitted on Mar 12, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers26

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!