Problem 46582. Find jumping medalists

Key questions in number theory involve the distribution of prime numbers. For example, the Twin Prime Conjecture states that infinitely many twin primes, or two primes separated by 2, exist. This conjecture has not been proved, and progress is addressed in an interesting video from Numberphile.
This problem deals with the most common gap between primes up to a given number. John Conway dubbed this gap the jumping champion. For numbers up to 20, the jumping champion is 2 because it occurs four times (between 3 and 5, 5 and 7, 11 and 13, and 17 and 19.)
To me, the jumping champion is somewhat disappointing because 6 dominates until about 1.74. Therefore, I will coin another term: the jumping medalists, or the three most common gaps between primes up to a given number. For numbers up to 20, the gold, silver, and bronze jumping medals (i.e., first, second, and third place) go to 2, 4, and 1, respectively.
Write a function that determines the jumping medalists as well as the maximum gap. Award the medals as in Cody Problem 46576 and return an empty vector for any medal that cannot be awarded.

Solution Stats

37.93% Correct | 62.07% Incorrect
Last Solution submitted on Sep 09, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers17

Suggested Problems

More from this Author279

Community Treasure Hunt

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

Start Hunting!