How to print the first 100 primes including 1 as a vector
显示 更早的评论
i need to print vectors containing all prime numbers less than 100, including 1 as 1 is usually not shown as a prime number in matlab. Thanks
采纳的回答
更多回答(1 个)
Udit Gupta
2014-5-29
To print prime numbers less than 100 use
primeNums = [1 primes(100)]
To print first 100 frime numbers use
primeNums = [1 primes(523)]
类别
在 帮助中心 和 File Exchange 中查找有关 Discrete Math 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!