# Sequence of primes by trial division

Using the _is\_prime()_ function from: ["Primality by trial division"](https://rosettacode.org/wiki/Primality_by_trial_division#Sidef)

```ruby
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
```
