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