Commits

Shlomi Fish  committed 900a836

Solved! But still kinda slow.

  • Participants
  • Parent commits 69fc9d8

Comments (0)

Files changed (1)

File project-euler/142/142.pl

 use strict;
 use warnings;
 
+use integer;
+
 use IO::All;
 
 # use Math::BigInt lib => 'GMP';
     return ($root * $root == $n);
 }
 
+my $milestone_step = 10_000;
+my $next_milestone = $milestone_step;
+
 foreach my $x (1 .. 1_000_000)
 {
     my $limit = int(sqrt($x));
         {
             next Y_LOOP;
         }
-        print "Reached X=$x Y=$y\n";
+        if ($x >= $next_milestone)
+        {
+            print "Reached X=$x Y=$y\n";
+            $next_milestone += $milestone_step;
+        }
 
         my $y_limit = int(sqrt($y));
         foreach my $y_diff_root (1 .. $y_limit)