home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / FIBONACC.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  468 b   |  18 lines

  1.  
  2. (*********************************************************************
  3.  
  4.         Adapted from
  5.         Roman E. Maeder: Programming in Mathematica,
  6.         Second Edition, Addison-Wesley, 1991.
  7.  
  8.  *********************************************************************)
  9.  
  10.  
  11. Fibonacci::usage = "Fibonacci[n] computes the n-th Fibonacci number."
  12.  
  13. Fibonacci[n_Integer?Positive] :=
  14.     Module[{fn1=1, fn2=0},
  15.         Do[ {fn1, fn2} = {fn1 + fn2, fn1}, {n-1} ];
  16.         fn1
  17.     ]
  18.