From 612a67527b8d2a3c07098fbae5ad06a1cf46a741 Mon Sep 17 00:00:00 2001 From: Ivan Zahariev Date: Fri, 12 Jan 2018 12:23:12 +0200 Subject: [PATCH] Minor refactoring, so that the code workflow is the same as the other languages --- primes.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/primes.swift b/primes.swift index 8b594c9..37904c9 100644 --- a/primes.swift +++ b/primes.swift @@ -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 } }