Skip to content

Instantly share code, notes, and snippets.

@Keita-N
Created October 5, 2016 02:40
Show Gist options
  • Save Keita-N/9bfdab2e53aa152294d35059f29ecfbe to your computer and use it in GitHub Desktop.
Save Keita-N/9bfdab2e53aa152294d35059f29ecfbe to your computer and use it in GitHub Desktop.
{def f(a:Int,n:Int,m:Int):Stream[Int]=if(a==m)f(a+n,n+1,m+1)else m #::f(a,n,m+1)
f(1,2,1)}.takeWhile(_<101).foreach(println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment