If you need to generate primes from 1 to N, the \"dumb\" way to do it would be to iterate through all the numbers from 2 to N and check if the numbers are divisable by any p
A "naive" Sieve of Eratosthenes will mark non-prime numbers multiple times. But, if you have your numbers on a linked list and remove numbers taht are multiples (you will still need to walk the remainder of the list), the work left to do after finding a prime is always smaller than it was before finding the prime.