// Generate returns all of the prime numbers equal to or less than the target.
Generate returns all of the prime numbers equal to or less than the target.
// Generate returns all of the prime numbers equal to or less than the target .
func Generate(out chan<- uint64, target uint64) {
	sieve := newSieve(target)
	i := uint64(0)
	j := uint64(0)
	out <- 2
	sqrt := uint64(math.Sqrt(float64(target)))
	for i = 3; i <= sqrt; i += 2 {
		if !sieve.check(i) {
			for j = i * i; j <= target; j += i {
				sieve.set(j)
			}
			out <- i
		}
	}
	for ; i <= target; i += 2 {
		if !sieve.check(i) {
			out <- i
		}
	}
	close(out)
}
func Generate ( out chan <- uint64 , target uint64 ) { sieve := newSieve ( target ) i := uint64 ( 0 ) j := uint64 ( 0 ) out <- 2 sqrt := uint64 ( math . Sqrt ( float64 ( target ) ) ) for i = 3 ; i <= sqrt ; i += 2 { if ! sieve . check ( i ) { for j = i * i ; j <= target ; j += i { sieve . set ( j ) } out <- i } } for ; i <= target ; i += 2 { if ! sieve . check ( i ) { out <- i } } close ( out ) }
Generate returns all of the prime numbers equal to or less than the target.
Generate returns all of the prime numbers equal to or less than the target .