RosettaCodeData/Task/Fibonacci-sequence/Perl/fibonacci-sequence-3.pl

25 lines
562 B
Perl
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
# Uses GMP method so very fast
use Math::AnyNum qw/fibonacci/;
say fibonacci(10000);
2015-02-20 00:35:01 -05:00
2018-06-22 20:57:24 +00:00
# Uses GMP method, so also very fast
2015-02-20 00:35:01 -05:00
use Math::GMP;
say Math::GMP::fibonacci(10000);
2018-06-22 20:57:24 +00:00
# Binary ladder, GMP if available, Pure Perl otherwise
use ntheory qw/lucasu/;
say lucasu(1, -1, 10000);
2015-02-20 00:35:01 -05:00
# All Perl
use Math::NumSeq::Fibonacci;
my $seq = Math::NumSeq::Fibonacci->new;
say $seq->ith(10000);
# All Perl
use Math::Big qw/fibonacci/;
say 0+fibonacci(10000); # Force scalar context
# Perl, gives floating point *approximation*
use Math::Fibonacci qw/term/;
say term(10000);