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

조회 수: 3 (최근 30일)
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.

답변 (1개)

the cyclist
the cyclist 2015년 9월 11일
편집: the cyclist 2015년 9월 11일
N = 100;
primes(N)

카테고리

Help CenterFile Exchange에서 Discrete Math에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by