Try to answer bonus question
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Raiven Balderas
am 7 Feb. 2018
Kommentiert: Birdman
am 7 Feb. 2018
Screenshot is attached. Comment what the code to the bonus question is. Also provide explanations.
0 Kommentare
Akzeptierte Antwort
Birdman
am 7 Feb. 2018
Bearbeitet: Birdman
am 7 Feb. 2018
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
3 Kommentare
Birdman
am 7 Feb. 2018
It does plot. For instance:
n=10;
plot((1:numel(primes(n)))+1,primes(n),'-o')
and check the attached figure.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!