Problem 60939. Frequencies of prime gaps

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

78.13% Correct | 21.88% Incorrect
Last Solution submitted on Aug 17, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers20

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!