Puppet Function: math::fibonacci::table

Defined in:
functions/fibonacci/table.pp
Function type:
Puppet Language

Summary

Calculate the fibonacci sequence for the given number using table method

Overview

math::fibonacci::table(Numeric $n)Numeric
Note:

The input value maxes out at 27 because it takes too long to calclulate

Note:

Example of how to perform this calculation www.wikihow.com/Calculate-the-Fibonacci-Sequence

Parameters:

  • n (Numeric)

Returns:

  • (Numeric)


6
7
8
9
10
11
# File 'functions/fibonacci/table.pp', line 6

function math::fibonacci::table(Numeric $n) >> Numeric {
  if $n <= 1 {
    return $n
  }
  ( math::fibonacci::table( $n - 1 ) + math::fibonacci::table( $n - 2 ) )
}