Sequence of primes by Trial Division

Using the is_prime() function from: "Primality by trial division"

func prime_seq(amount, callback) {
    var (counter, number) = (0, 0)
    while (counter < amount) {
        if (is_prime(number)) {
            callback(number)
            ++counter
        }
        ++number
    }
}

prime_seq(100, {|p| say p })     # prints the first 100 primes