Matt Owen

source code for "files/pe/pe_057.pl"

return to portfolio
  1.  #!/usr/bin/perl
  2.  
  3.  use strict;
  4.  use warnings;
  5.  use bigint;
  6.  
  7.  my ($p, $q) = (3, 2);
  8.  my ($c) = 0;
  9.  
  10.  for (1..1000) {
  11.   $c++ if (length $p > length $q);
  12.   ($p, $q) = ($p+2*$q, $p+$q);
  13.  }
  14.  
  15.  
  16.  print $c;