Math::Fibonacci3pm
Fibonacci numbers.
Usage
use Math::Fibonacci qw(term series decompose);my $term = term ( 42 );my @series = series ( 42 );my @sum = decompose ( 65535 );
Version
$Revision: 1.5 $
Overview
This module provides a few functions related to Fibonacci numbers.
Exports on request
term(), series() decompose(), isfibonacci()
Functions
term($n)-
Returns the
$n-th term of the Fibonacci sequence. The term is computed using the fast algorithm:"F(n) ~ g^n/sqrt(5)", where g is the golden ratio and ~ means "take the nearest integer".
series($n)-
Computes and returns the first
$nFibonacci numbers.
decompose($int)-
Decomposes
$intinto the sum of Fibonacci numbers. Returns the list of Fibonacci numbers.
isfibonacci($int)-
Returns the sequence number of
$intif it is a Fibonacci number or a non-true value if it is not.
Releases
10 releases since Debian 4.0 (Etch); the text changed 4 times.