#
# This software is Copyright 2005 by Elsevier Inc.  You may use it
# under the terms of the license at http://perl.plover.com/hop/LICENSE.txt .
#



###
### fib2
###

## Chapter 5 section 4.3.1

sub fib {
  my $n = shift;
  while (1) {
    if ($n < 2) {
      return $n;
    } else {
      my $s1 = fib($n-2);
      my $s2 = fib($n-1);
      return $s1 + $s2;
    }
  }
}
