Brainbench perl test?

Paul Makepeace paulm at paulm.com
Wed Sep 5 18:47:24 BST 2012


On Wed, Sep 5, 2012 at 9:35 AM, Abigail <abigail at abigail.be> wrote:
> Your first instinct should be "Is there a generating function I can use?".

Try not to blow your cache pipeline with all that silly branching,

sub fib {
  my $n = shift;
  int(0.5 + (0.5+0.5*sqrt 5) ** $n / sqrt 5);
}

High five! :-)

Paul


More information about the london.pm mailing list