#!/bin/env perl -w
use strict;
use bigrat;
my $ofile="../output/cfract.txt";
open (CF, "> $ofile") || die("Can't open $ofile: $!");
my $x;
my$i;
my @cf;
my $cfindex;
for($i=2;$i<=1000;$i++){
$cfindex=0;
$x=sqrt($i/1);
while (($x!=int($x)) && ($cfindex<20)) {
$cf[$cfindex]=int($x);
$x-=$cf[$cfindex];
$x=(1/$x);
$cfindex++;
}
if($x!=int($x)){
print CF "\$i:$i\t\@cf= @cf\n";}
}
close(CF);
print "Done\n";
|