Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Fibonacci numbers using regexes (threes are wild)

by Anonymous Monk
on Nov 29, 2009 at 06:23 UTC ( [id://809968]=note: print w/replies, xml ) Need Help??


in reply to Fibonacci numbers using regexes (threes are wild)

$; is used as an ordinary variable. It could have been $f. For each character in the string, if zero it is replaced by 3, if 3 it is replaced by 30, thus yielding the sequence 3, 30, 303, 30330, 30330303. Each value is simply the concatenation of the previous two values; for example, 30330303 is 30330 followed by 303. Thus, its length is the sum of the two previous lengths, yielding Fiboncci numbers. If you replace 0's by newborn and 3's by old rabbits you get Fibonacci's model of population growth

  • Comment on Re: Fibonacci numbers using regexes (threes are wild)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found