The process of sieving numbers has some interesting features in number theory. Another sieve starts as for the Sieve of Eratosthenes but this time sieves only numbers that have not been eliminated. It starts very much the same: you remove every second number after two. Next you remove every third number that is left apart from three itself. Next you look for the next number (let us call it $n$ ) that has not been eliminated so far and then eliminate every $n$th still un-eliminated number and so on.
Try to write a program to carry out this process. Be warned that it is considerably less elegant than the one for primes.