MATLAB: Try to answer bonus question

MATLAB

Screenshot is attached. Comment what the code to the bonus question is. Also provide explanations.

Best Answer

By using primes built in function of MATLAB:
function y=prime_count(n)
y=numel(primes(n));
plot(primes(n))
end
From command line:
prime_count(10)
>> 4