Skip to content

Instantly share code, notes, and snippets.

@schmmd
Created May 4, 2015 21:39
Show Gist options
  • Save schmmd/e33d58797133d6b705bf to your computer and use it in GitHub Desktop.
Save schmmd/e33d58797133d6b705bf to your computer and use it in GitHub Desktop.
Quispy
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.5"
libraryDependencies += "com.github.rodneykinney" % "quisp_2.11" % "0.5.0"
*/
import quisp.Plot._
object Main extends App {
val primes = Stream.from(2).filter { n =>
(2 until n).forall(m => n % m != 0)
}
println(primes.take(10))
val pi = Iterator.from(0).map { x =>
primes.takeWhile(p => p < x).size
}
val chart = line(pi.take(100).toSeq)
chart.title.text("Prime Counting Function")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment