4 ms·
The sieve of Eratosthenes can be adapted to build tables of other number properties: smallest prime factor, totient function, number of unique prime factors (om
by nayuki 9y ago
The sieve of Eratosthenes can be adapted to build tables of other number properties: smallest prime factor, totient function, number of unique prime factors (omega), product of unique prime factors (radical).
Contains code in Python and other languages: https://www.nayuki.io/page/the-versatile-sieve-of-eratosthenes https://www.nayuki.io/page/the-versatile-sieve-of-eratosthen...