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
Problem Comments
-
3 Comments
Jean-Marie Sainthillier
on 3 Apr 2021
In test6 with n=100, J3=1 no ?
ChrisR
on 5 Apr 2021
Jean-Marie, in Test 6, three medals (1 gold, 2 silver) have already been awarded. By the rules from Cody Problem 46576, no bronze is awarded.
Jean-Marie Sainthillier
on 5 Apr 2021
OK.
Thanks.
Solution Comments
Show commentsProblem Recent Solvers17
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15529 Solvers
-
Back to basics 11 - Max Integer
785 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
540 Solvers
-
118 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1072 Solvers
More from this Author279
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!