All pastes #346053 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-09 01:13 UTC
rendered paste body
#!/usr/bin/perl -w

$TheNextNum = 0;

sub gen_fib {
   my($curr, $next) = (0,1); return sub { my $fib = $curr; ($curr, $next) = ($next, $curr + $next); return $fib; }; }

my $fib_stream1 = gen_fib();

# print first 100 fibonacci numbers from stream 1
for(1..10000){
   $TheNextNum = $fib_stream1->();
   if(($TheNextNum % (2**32)) == 0){
      print $TheNextNum;
      print "\n";
   }
}

print "\n";