# Commits

committed 431d940

Add the (too slow so far) solution to Euler #138.

# project-euler/138/138-analysis.txt

` Find ∑ L for the twelve smallest isosceles triangles for which h = b ± 1 and b, L are positive integers.`
` [/QUOTE]`
` `
`-h = b +/- 1.`
`+h = b ± 1.`
` `
`-b/2 = h/2 +/- 1/2.`
`+b/2 = h/2 ± 1/2.`
` `
` L = sqrt [ h^2 + (h/2 +/- 1/2)^2 ] = sqrt [ 5/4h^2 + 1/4 +/- h/2 ] `
`+`
`+a = h/2`
`+`
`+L = sqrt[ 5a^2 + 1/4 ± a ]`

# project-euler/138/euler-138-1.pl

`+#!/usr/bin/perl`
`+`
`+use strict;`
`+use warnings;`
`+`
`+use Math::BigRat lib => 'GMP';`
`+`
`+my \$h = 2;`
`+`
`+my \$c2 = Math::BigRat->new('5/4');`
`+my \$c0 = Math::BigRat->new('1/4');`
`+my \$c1_p = Math::BigRat->new('1/2');`
`+my \$c1_m = Math::BigRat->new('-1/2');`
`+`
`+while (1)`
`+{`
`+    foreach my \$c1 (\$c1_m, \$c1_p)`
`+    {`
`+        my \$L = (\$c0 + \$h*(\$c1 + \$h*\$c2))->bsqrt();`
`+        my \$L_int = \$L->as_int();`
`+        if (\$L_int == \$L)`
`+        {`
`+            print "Found \$L_int\n";`
`+        }`
`+    }`
`+}`
`+continue`
`+{`
`+    \$h+=2;`
`+}`