package sieve

import "fmt"

// Sieve applies the Sieve of Eratosthenes up to depth
// Returning a slice of all of the results
func Sieve(depth int) []int {
	var primes []int
	test := 2
	for test <= depth {
		testIsPrime := true
		for idx := range primes {
			if test%primes[idx] == 0 {
				testIsPrime = false
				break
			}
		}
		if testIsPrime {
			primes = append(primes, test)
		}
		test++
		fmt.Println("")
	}
	return primes
}
