Consider the isosceles triangle with base length, b = 16, and legs, L = 17.
By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length.
With b = 272 and L = 305, we get h = 273, which is one more than the base length, and this is the second smallest isosceles triangle with the property that h = b ± 1.
Find ∑ L for the twelve smallest isosceles triangles for which h = b ± 1 and b, L are positive integers.
There are two ways to solve this problem. The first is to generate some triangles that match the requirements and search for an integer sequence; which we found. It turns out that one-half of every 6th iteration of the Fibonacci sequence, starting at the 9th, yields a solution for L. Namely: 34, 610, 10946, 196418, etc. or F(6n+3), n=1..12.
The second way, and actually more intuitive, is to solve for the Diophantine quadratic equation as:
(assuming x for b/2 to achieve integer coefficient for the resulting equation)
Take a run over to: http://www.alpertron.com.ar/QUAD.HTM, and plug in the coefficients to calculate:
5 x2 - y2 + 4 x +1 = 0 by Dario Alejandro Alpern X0 = 0 Y0 = -1 and also: X0 = 0 Y0 = 1
Xn+1 = P Xn + Q Yn + K Yn+1 = R Xn + S Yn + LP = -9 Q = -4 K = -4 R = -20 S = -9 L = -8
We verified this solution, but never had the need to implement it.
Runs < 1 second in Python.
from Euler import Fibonacci nt = 12 f = Fibonacci() print "Answer to PE138 =", sum( [f[6*n+3]/2 for n in range(1, nt+1)] )
See Sloane’s A007805.