Help for this page

Select Code to Download


  1. or download this
    use Math::Pari 'lcm';my($n,$d)=split/\//,shift;sub p{print"1/$_[0] "}w
    +hile(1){my
    $u=int$d/$n+1;p$u;my $l=lcm$d,$u;$n=$n*$l/$d-$l/$u;$d=$l;p($d),die$/if
    +$n==1}
    
  2. or download this
    ($n,$d)=split/\//,shift;sub p{print"1/$_[0] "}while(1){use Math::Pari
    lcm;$u=int$d/$n+1;p$u;$l=lcm$d,$u;$n=$n*$l/$d-$l/$u;$d=$l;p($d),die$/i
    +f$n==1}
    
  3. or download this
    #!/usr/bin/perl
    use strict;
    ...
        push @result, $den and last if $num == 1;    
    }
    print "1/$_ " for @result;