Sieve Sieving the numbers that are not prime from the channel - basically removing them from the channels
(in <-chan int, out chan<- int, prime int)
| 14 | |
| 15 | // Sieve Sieving the numbers that are not prime from the channel - basically removing them from the channels |
| 16 | func Sieve(in <-chan int, out chan<- int, prime int) { |
| 17 | for { |
| 18 | i := <-in |
| 19 | if i%prime != 0 { |
| 20 | out <- i |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // Generate returns a int slice of prime numbers up to the limit |
| 26 | func Generate(limit int) []int { |