use bigrat; for (my $n=1; $n<=30; ++$n) { my $s = 0; for (my $k=1; $k<$n; ++$k) { $s += $k / ($n-$k); } print "n = $n, s = $s\n"; }