Last active
August 25, 2015 22:54
-
-
Save ynarwal/5804f5264385e4c20e14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nthterm(first, n, c) | |
# Write here ! | |
if(n == 1) | |
first | |
end | |
if(first == 0) | |
nth = c + nthterm((first+c), (n-1), c) | |
else | |
nth = c * nthterm((first*c), (n-1), c) | |
end | |
nth | |
end | |
##It gives me stack level too deep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment