Re: bignum 0.22
- From: José Luis Pérez Diez <jluis@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Jul 2007 13:46:03 +0200
In article <Pine.LNX.4.64.0707041540080.19628@xxxxxx>, Gamo wrote:
I found a problem related with calculating Catalan's numbers^^
#!/usr/local/bin/perl -w
use bignum;
use bingnum qw(p 0); #instead see perldoc bignum;
while (1){
$n++;
# $Cat = (fact(2*$n))/((n+1)!n!)
$Cat = (fact(2*$n))/(($n+1)*fact($n)**2);
print "$Cat\n";
last if length $Cat > 78;
}
To use this algoritm the precison must be 0 because all the numbers are
integers.
133 =
43247909631719355347185999181748231619129200590055369794426007640095877
732860
134 =
17106950920991211670664684120780411618233328233399679607572954133193480
5254424
135 =
67673085260979940285423529830734275372128901393889909035840068556309503
8432942
136 =
26772855628796443528977776035224800913645156609845496859434538071182300
06063172
.
- References:
- bignum 0.22
- From: gamo
- bignum 0.22
- Prev by Date: Re: bignum 0.22
- Next by Date: Re: bignum 0.22
- Previous by thread: Re: bignum 0.22
- Next by thread: LibXML and DTD's
- Index(es):