Count Primes Posted on 2016-10-19 | Shame 12345678910111213141516171819func Primes(n int) (ans []int) { if n < 2 { return } ans = append(ans, 2) for i := 3; i <= n; i++ { ansBool := true for _, prime := range ans { if i%prime == 0 { ansBool = false break } } if ansBool { ans = append(ans, i) } } return}