Focus
- 285
- 3
SW VandeCarr said:You're not talking about a sieve, are you? To me, a sieve is a dumb algorithm which tests all odd numbers not ending in 5. That's not what I meant. I meant a smart algorithm which can produce all the primes and only the primes. Such an algorithm would also tell us the number of primes over any specified interval of natural numbers.
What is a "smart" algorithm? Do you mean an algorithm that has a polynomial complexity? I can write you an algorithm that can generate all primes (and only primes) and one for telling you how many primes are in a given finite subset of the naturals. You can tell the algorithm to output infinity whenever you enter a infinite subset.