how can i write a script file to find all prime numbers from a given range of numbers?

3 vues (au cours des 30 derniers jours)
bachir
bachir le 11 Sep 2015
Modifié(e) : the cyclist le 11 Sep 2015
I need to find all prime numbers from 0-n (user input n) and n can be anything from 0 to 100. I want to do this for a range from 0-24, so I want matlab to display all prime numbers from 0-24. I don't know where to start though.

Réponses (1)

the cyclist
the cyclist le 11 Sep 2015
Modifié(e) : the cyclist le 11 Sep 2015
N = 100;
primes(N)

Catégories

En savoir plus sur Discrete Math dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by