Minor refactoring, so that the code workflow is the same as the other languages
parent
29cc736cd6
commit
612a67527b
|
@ -17,13 +17,14 @@ func get_primes7(_ n: Int) -> [Int] {
|
||||||
while m <= mroot {
|
while m <= mroot {
|
||||||
if s[i] != 0 {
|
if s[i] != 0 {
|
||||||
var j: Int = (m*m - 3) / 2
|
var j: Int = (m*m - 3) / 2
|
||||||
|
s[j] = 0
|
||||||
while j < half {
|
while j < half {
|
||||||
s[j] = 0
|
s[j] = 0
|
||||||
j += m
|
j += m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i += 1
|
i += 1
|
||||||
m += 2
|
m = 2*i + 3
|
||||||
}
|
}
|
||||||
return [2] + s.filter { $0 != 0 }
|
return [2] + s.filter { $0 != 0 }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue