{"height":"190","provider_name":"Hatena Blog","blog_title":"Camera Obscura","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2017%2F10%2F05%2F145618\" title=\"Swift \u3067\u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9 - Camera Obscura\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://obelisk.hatenablog.com/entry/2017/10/05/145618","image_url":null,"version":"1.0","blog_url":"https://obelisk.hatenablog.com/","author_name":"obelisk2","provider_url":"https://hatena.blog","description":"\u3053\u3093\u306a\u611f\u3058\u3002 eratosthenes.swift func eratosthenes(_ n: Int) -> [Int] { var ar = Array(0...n) for i in 2...Int(sqrt(Double(n))) { if ar[i] == 0 {continue} for j in 2...(n / i) {ar[i * j] = 0} } return ar.filter {$0 != 0} } print(eratosthenes(1000)) 1000\u4e07\u307e\u3067\u306e\u7d20\u6570\u3092\u6c42\u3081\u3066\u307f\u307e\u3057\u305f\uff08\u51fa\u529b\u306f\u3057\u3066\u3044\u307e\u305b\u3093\uff09\u3002Swift 4.0, Linux Mint 18.2\u3002 \u2026","author_url":"https://blog.hatena.ne.jp/obelisk2/","categories":["Swift","\u6570\u5b66"],"type":"rich","published":"2017-10-05 14:56:18","title":"Swift \u3067\u30a8\u30e9\u30c8\u30b9\u30c6\u30cd\u30b9\u306e\u7be9"}