MATLAB: How to find first ten prime numbers that are greater than 4

arrayprimes

Hi,
How am I going to make an array that consists of first 10 prime numbers that are greater than 4 as follows?
a=[5 7 11 13 17 19 23 29 31 37]
Thank you.

Best Answer

You could do it like this
x = primes(100); %pick primes smaller than, say 100
x = x(x>4); %pick the ones larger than 4
x(1:10) %pick the first ten of those