// source: https://rosettacode.org/wiki/Sieve_of_Eratosthenes // license: GFDL 1.2 (Rosetta Code) // fetched: 2026-10-14 (Rosetta Code "Kotlin" section, verbatim) import kotlin.math.sqrt fun sieve(max: Int): List { val xs = (2..max).toMutableList() val limit = sqrt(max.toDouble()).toInt() for (x in 2..limit) xs -= x * x..max step x return xs } fun main(args: Array) { println(sieve(100)) }