Problem 49783. List the good primes
The mth prime is classified as “good” if for . For example, 5 is a good prime because is greater than and , but 7 is not because .
Write a function to list the first n good primes.
Solution Stats
Problem Comments
-
4 Comments
Show
1 older comment
Jean-Marie Sainthillier
on 23 Nov 2021
In the description, k>=1
ChrisR
on 20 Dec 2021
Thanks--fixed.
Christian Schröder
on 25 Mar 2023
Why is 2 not a good prime? With m = 1, it trivially holds that p_m^2 > p_{m-k} p_{m+k} for all 1 \le k \le m-1 since this is in fact an empty statement then.
ChrisR
on 28 Mar 2023
It's not included in the lists I've seen probably because there is no zeroth prime.
Solution Comments
Show commentsProblem Recent Solvers14
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
8912 Solvers
-
Swap the first and last columns
20438 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1100 Solvers
-
Fix the last element of a cell array
1341 Solvers
-
5183 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!