Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Behold! The power of recursion.

by pg (Canon)
on Oct 18, 2004 at 04:32 UTC ( #400058=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
        my $avg =$total / (2 ** $i - 1);
        print "For range 1 .. $last, total guesses = $total, avg = $avg\n"
    +;
    } 
    
  2. or download this
    For range 1 .. 1, total guesses = 1, avg = 1
    For range 1 .. 3, total guesses = 5, avg = 1.66666666666667
    ...
    For range 1 .. 262143, total guesses = 4456449, avg = 17.0000686648127
    For range 1 .. 524287, total guesses = 9437185, avg = 18.0000362396931
    For range 1 .. 1048575, total guesses = 19922945, avg = 19.00001907350
    +45
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (17)
As of 2015-07-29 19:41 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 (267 votes), past polls