#!/bin/perl -w # e2 - approximates e using the limit definition: # # e = lim (n->infinity) [1 + 1/n]^n # # usage example: perl e2.pl 40 55 # # ...approximates e based on n's 40 - 55. use warnings; use strict; my $start_number = $ARGV[0] || 1; my $end_number = $ARGV[1] || 1; my ($currval, $cx); for ($cx = $start_number; $cx <= $end_number; $cx++) { $currval = (1 + (1/$cx))**($cx); print "$currval\n"; }