我已經閱讀了 Scala
Eratosthenes 篩選
def eratosthenes(toNum: Int) = {
def sieveHelp(r: IndexedSeq[Int]): Stream[Int] = {
if(r
Stream
else
r
}
sieveHelp(
}
Sundaram 篩選
def sundaram(toNum: Int) = {
val n = (toNum
val nonPrimes = for (i <
}
其中 Sundaram 篩選方法運行
從上圖你可以看出
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26470.html