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 {
|
||||
if s[i] != 0 {
|
||||
var j: Int = (m*m - 3) / 2
|
||||
s[j] = 0
|
||||
while j < half {
|
||||
s[j] = 0
|
||||
j += m
|
||||
}
|
||||
}
|
||||
i += 1
|
||||
m += 2
|
||||
m = 2*i + 3
|
||||
}
|
||||
return [2] + s.filter { $0 != 0 }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue