Well, it's simply true - we need first to look at the lowest bit of a and b. If they are both zero, then, obviously, a^b == (a^b) + (1^1) == (a+1)^(b+1).This occurs 25% of the time.
The next (interesting) case would be that both lowest bits of a and b are 1, and the second lowest bit of both, a and b, is 0. Then again, a^b == (a+1)^(b+1).
I'm not sure, if this method of counting will arrive at 33% overall, as there are some other possibilities (like a=5, b=6) which I didn't count, but 25% is close enough to 33% to mark this method of generating random numbers as dangerous.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|