Answer by Dmitry Kalita for Postponed Prime Sequence in Kotlin
I just compared two solution suggested above in term of performance: println("PostponedPrimeSequence: ${measureTimeMillis { PostponedPrimeSequence().take(10000).sum().let(::println) }}")...
View ArticleAnswer by mfulton26 for Postponed Prime Sequence in Kotlin
You can make basePrimes a lateinit non-null var to avoid !!.sieve and initialPrimes are only assigned once so they can be marked with val instead of varsequenceOf(2, 3, 4, 7).iterator() can be used...
View ArticlePostponed Prime Sequence in Kotlin
Following my previous unbounded prime generator and a followup by Martin R, I've tested the waters in Kotlin by making an unbounded sieve.To quote Martin R's wonderful explanation of the base...
View Article
More Pages to Explore .....