It’s not only the Sieve of Eratosthenes that uses the speed advantage of iterating over multiples.

Number of Divisors of Each Integer up to $n$

Storing Divisors

Even Faster Factorization by Storing Prime Divisors $(\mathcal{O}(\log n))$

These are some of the algorithms worth mentioning. There are so many other similar algorithms that use the same idea, but no doubt you can implement them yourselves!

Let’s move on to a brand new topic: GCD & LCM!