Legendre prime counting function: Difference between revisions

Content added Content deleted
m (→‎Iterative, partial sieving: Aligned with VLang.)
m (→‎Iterative, partial sieving: Aligned with VLang.)
Line 1,137: Line 1,137:


func countPrimes(n uint64) int64 {
func countPrimes(n uint64) int64 {
if n < 3 {
if n < 9 {
if n < 2 {
if n < 2 {
return 0
return 0
} else {
} else {
return 1
return (int64(n) + 1) / 2
}
}
}
}