Skip to content

Instantly share code, notes, and snippets.

@berdosi
Last active February 28, 2017 09:34
Show Gist options
  • Save berdosi/dad46aa82080de58365bb059f3e5da0c to your computer and use it in GitHub Desktop.
Save berdosi/dad46aa82080de58365bb059f3e5da0c to your computer and use it in GitHub Desktop.
function* fibonacci() { var act = 1, prev = 1; while (true) { t = act; yield act = (act + prev); prev = t } }
// not the primes, but binary according to primality
function* primes(){ var n = 2; while(true) {for(var i=2;i<=Math.sqrt(n);i++) if (0==n%i) yield false, ++n; yield true, ++n} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment