Don't print primes
This commit is contained in:
parent
27b131c982
commit
7384eaccf6
|
@ -14,24 +14,13 @@ func main() {
|
|||
}
|
||||
t0 := time.Now()
|
||||
sieve := make([]bool, n)
|
||||
col := 0
|
||||
var found int64
|
||||
var i int64
|
||||
i = 2
|
||||
found++
|
||||
s := fmt.Sprintf("%d, ", i)
|
||||
fmt.Print(s)
|
||||
col += len(s)
|
||||
for i = 3; i < n; i += 2 {
|
||||
if !sieve[i] {
|
||||
found++
|
||||
s := fmt.Sprintf("%d, ", i)
|
||||
if col+len(s) > 80 {
|
||||
fmt.Print("\n")
|
||||
col = 0
|
||||
}
|
||||
fmt.Print(s)
|
||||
col += len(s)
|
||||
for j := i * i; j < n; j += 2 * i {
|
||||
sieve[j] = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue