Re: [Nolug] In case you wanted to know how big 2 to the 3,000,000 is...

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: Thu, 01 Jul 2004 20:32:29 -0500
Message-Id: <1088731949.5345.4.camel@haggis.homelan>

On Thu, 2004-07-01 at 14:08 -0500, Friedrich Gurtler wrote:
> >
> >
> >I tried it in perl, the output i got was 3.
> >
> >3 is the length of the string 'inf', hahaha...
> >
> >ray
> >
>
> >Surprise..... 131 seconds. (Roughly under 3 minutes.)
> >
> >I got the same result
> >length: 903090
> >time: 131
> >
>
> I tried it in perl too, but got rather different results.
>
> use Math::BigInt lib=>'GMP';
> print Math::BigInt->new('1')->blsft(3000000, 2)->length() ."\n";
>
> fritz $ time perl test.pl
> 903090
>
> real 0m10.035s
> user 0m8.320s
> sys 0m0.160s
>
> 10 seconds on a 667 Mhz Mac. It is all about how smart your algorithm
> is. (Or perhaps Macs are that powerful! ;-) )

10 seconds, eh? What's that Mac running??

$ uname -srm
Linux 2.6.6 i686

$ cat bignum.pl
use Math::BigInt lib=>'GMP';
print Math::BigInt->new('1')->blsft(3000000, 2)->length() ."\n";

time perl bignum.pl
903090

real 184m8.801s
user 181m28.241s
sys 0m1.110s

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
"they love our milk and honey, but preach about another way of
living"
Merle Haggard, "The Fighting Side Of Me"
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/01/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST