• Home
  • Textbooks
  • You Can Do It!: A Beginners Introduction to Computer Programming
  • A Pot Pourri Spiced with Bitset

You Can Do It!: A Beginners Introduction to Computer Programming

Francis Glassborow

Chapter 12

A Pot Pourri Spiced with Bitset - all with Video Answers

Educators


Chapter Questions

Problem 1

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.

Check back soon!