Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: phi div by 0 error

by Laurent_R (Prior)
on Sep 01, 2013 at 16:32 UTC ( #1051826=note: print w/ replies, xml ) Need Help??


in reply to phi div by 0 error

Just for fun, with a recursive definition of the Fibonacci function:

#!/usr/bin/perl use strict; use warnings; use Memoize; memoize 'fibo'; my $val = shift; printf "%.12f\n", fibo($val+1)/fibo($val); sub fibo { my $n = shift; return $n if ($n < 2); return fibo ($n-1) + fibo ($n-2); }

This gives the following result:

$ perl fibo3.pl 32 1.618033988750


Comment on Re: phi div by 0 error
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051826]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2015-07-06 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls