Anonymous user
Legendre prime counting function: Difference between revisions
Legendre prime counting function (view source)
Revision as of 16:19, 29 September 2021
, 2 years agoSwift: Add missing extension
m (cleanup swift) |
m (Swift: Add missing extension) |
||
Line 768:
<lang swift>import Foundation
extension Numeric where Self: Strideable {
@inlinable
public func power(_ n: Self) -> Self {
return stride(from: 0, to: n, by: 1).lazy.map({_ in self }).reduce(1, *)
}
}
func eratosthenes(limit: Int) -> [Int] {
Line 834 ⟶ 841:
for i in 0..<10 {
let n = 10.
print("π(10^\(i)) = \(π(n: n))")
|