equal
deleted
inserted
replaced
290 def generatePrimes (s: Stream[Int]): Stream[Int] = |
290 def generatePrimes (s: Stream[Int]): Stream[Int] = |
291 s.head #:: generatePrimes(s.tail filter (_ % s.head != 0)) |
291 s.head #:: generatePrimes(s.tail filter (_ % s.head != 0)) |
292 |
292 |
293 val primes: Stream[Int] = generatePrimes(Stream.from(2)) |
293 val primes: Stream[Int] = generatePrimes(Stream.from(2)) |
294 |
294 |
|
295 primes.take(10).toList |
|
296 |
295 primes.filter(_ > 100).take(2000).toList |
297 primes.filter(_ > 100).take(2000).toList |
296 |
298 |
297 time_needed(1, primes.filter(_ > 100).take(2000).toList) |
299 time_needed(1, primes.filter(_ > 100).take(2000).toList) |
298 time_needed(1, primes.filter(_ > 100).take(2000).toList) |
300 time_needed(1, primes.filter(_ > 100).take(2000).toList) |
299 |
301 |