William, thanks for the comment. I thought the value of extrema was based on strict criteria. I stand corrected. The problem statement has been updated.
Tim, William, Chris - The faulty test case has been edited out of the test suite. Apologies for the inconvenience. Please attempt/edit your answer accordingly.
Chris, what if there are multiple pairs of (k,m) that result in a particular proth number, which pair should we report? For example - k=4, m=2, p=17 k=2, m=3, p=17 k=1, m=4, p=17 also k=1, m=2, p=5 k=2, m=1, p=5
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.