I read this quickly, but depending on what he means by “List A * list A” it sure sounds like just the most complicated way I’ve ever heard of specifying the Sieve of Eratosthenes: If you take the list of all numbers > 1, and subtract out all the multiples of each prime you find, in order, all that’s left are the primes.
Which is, if you think about it, pretty much just a straightforward application of the definition of prime numbers.
If, on the other hand, we parse “List A - List B” to mean “Take any given member of List A, and subtract off any given member of List B”, then one counterexample would be (616-1) - ((61+1)(61-1)) = 95 - 35 = 60, which is not prime.
That’s not what he means, though – he’s saying remove from list A those items that appear in list B.
It does indeed work. Basically, list A is a list of numbers that aren’t divisible by 2 or 3. Those that aren’t prime can be written as the product of two factors, but those factors also won’t be divisible by 2 or 3. Therefore the non-prime elements of A can be written as the product of two (not necessarily distinct) elements of A, and removing these leaves only the primes.
But just because it works doesn’t mean it’s particularly useful. For one thing, the procedure as stated involves taking all possible products of two elements from an infinite list of numbers. I’m not seeing how this is an improvement on the Sieve of Eratosthenes described in the first reply.
Yep, List A just has all the primes (plus assorted non-primes) >=5. List B is just a brute force way of finding those assorted non-primes. Not particularly any better than the Sieve of Eratosthenes which has the added benefit of being more comprehensible.
Since Chronos is already bored, I’ll mention that your pattern can be generalized.
Primes larger than 5 are of the form 30N +/-1, 30N +/- 7, 30N +/- 11, or 30N +/- 13. That’s about 26.67 percent of the 30 possibilities, compared with 33.33 percent when using 6N +/- 1 (in case you want to improve the efficiency of your sieve).
Primes larger than 7 are of the form 210 +/- 1, 210 +/- 11, …, 201 +/- 103. About 22 percent of the possibilities.