Hi all, i understand the following however i dont know how to put this on matlab.(adsbygoogle = window.adsbygoogle || []).push({});

any help or hints will be very appreciated.

The following algorithm enables us to identify the prime number up to a given integer N, by eliminating all non-primes in that interval. It starts from a lower end.

Start with 2, which is kept as prime. Eliminate all numbers divisible by 2 up to N.

Move then to the next bigger number that has not been eliminated, which is 3. Keep it as prime and eliminate all numbers divisible by 3 up to N.

Move then to the next bigger number that has not been eliminated, which is 5; etc.

When you reach N, all non-primes have been eliminated up to N.

Write a function M-file on the basis of this algorithm for an arbitrary upper bound N.

thank you

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab help

**Physics Forums | Science Articles, Homework Help, Discussion**