Commits

Shlomi Fish committed c4eb26c

Comments (0)

Files changed (2)

project-euler/137/euler-137-2.pl

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Math::GMP qw(:constant);
+
+my $this_fib = 1;
+my $prev_fib = 1;
+
+my $k = 2;
+my $count = 1;
+while (1)
+{
+    ($prev_fib, $this_fib) = ($this_fib, $prev_fib+$this_fib);
+    $k++;
+
+    if ($k % 2 == 1)
+    {
+        print "${count}-th Golden Nugget: ", ($prev_fib*$this_fib), "\n";
+        $count++;
+    }
+}
+

project-euler/137/html-analysis.html

 
     \text{rational iff (N+1)^2+4N^2 is a whole square.}
 
+    (N+1)^2+(2N)^2 = T^2
+
+    T^2-(2N)^2 = (N+1)^2
+    (T-2N)(T+2N) = (N+1)^2
+    (T-(N+1))(T+(N+1)) = (2N)^2
 \]
 </p>