Quantcast
Channel: Postponed Prime Sequence in Kotlin - Code Review Stack Exchange
Browsing all 3 articles
Browse latest View live

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 Article



Answer 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 Article

Postponed 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
Browsing all 3 articles
Browse latest View live




Latest Images