Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 exploiting the Monastery: (6)
As of 2015-07-06 02:26 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 (69 votes), past polls