Skip to content

Commit

Permalink
Update Problem7.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
ditekunov authored Jun 4, 2018
1 parent bf55775 commit fa5b319
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scala/Problem7.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i =>
ps.takeWhile(j => j * j <= i).forall(i % _ > 0))
object Main extends App {

val r = ps(10000)
//O(n*loglogn)
lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i =>
ps.takeWhile(j => j * j <= i).forall(i % _ > 0))

val r = ps(10000)

}

0 comments on commit fa5b319

Please sign in to comment.