nicojensen.de/vendor/bundle/gems/rouge-3.3.0/lib/rouge/demos/mathematica
Nico Jensen b59a203dbb Init
Init commit
2019-03-12 13:49:49 +01:00

8 lines
213 B
Text

(* Fibonacci numbers with memoization *)
fib::usage = "f[n] calculates the n'th Fibonacci number.";
fib[0] = fib[1] = 1;
fib[n_Integer?Positive]:= fib[n] = fib[n-1] + fib[n-2];
In[4]:= fib[42]
Out[4]= 433494437