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
Problem Comments
-
2 Comments
ChrisR
on 24 Jun 2025
For a related problem, see #46582.
Nicolas Douillet
on 25 Jun 2025
Thank you for the reference Chris.
Solution Comments
Show comments
Problem Recent Solvers22
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!