Algorithm to find prime numbers

455 Views Asked by At

For a loop up to positive integer $n$, I have deduced an algorithm that provides me with all the prime numbers plus some odd numbers, for example for $n=10000$ my algorithm gives me the count $1260$ while prime are $1229$.

In order to avoid the non-primes I run a loop till $1260$ and remove the numbers that are divisible by any of the number from the list of $1260$ numbers (provide from my algorithm) which provides me the exact number of primes ?

Is my approach correct or do I need to reconsider something?