Special Isosceles Triangles
Consider an isosceles triangle with base b, equal legs of length L, and height h (from the apex perpendicular to the base). The constraint is |b - h| = 1 (the base and height differ by exactly 1),...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
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 = \sqrt{17^2 - 8^2} = 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 \pm 1$.
Find $\sum L$ for the twelve smallest isosceles triangles for which $h = b \pm 1$ and $b$, $L$ are positive integers.
Problem 138: Special Isosceles Triangles
Mathematical Foundation
Theorem 1. The Pythagorean relation combined with and even (say ) leads to the Pell equation , where .
Proof. The height bisects the base, forming right triangles with legs and , and hypotenuse :
For to be an integer, must be even. (If were odd, would require ; checking modular conditions shows must be even for integer solutions.) Write , so .
Multiply by 5:
Setting :
Theorem 2. The fundamental solution of is . All positive solutions are given by for .
Proof. The continued fraction expansion of has period 1, which is odd, so is solvable. The convergent gives , confirming as the fundamental solution. All solutions of are obtained by taking odd powers of the fundamental element . Equivalently, using the fundamental solution of (obtained as ), successive solutions of the equation satisfy:
Lemma 1. The -components (i.e., the -values) satisfy the linear recurrence with characteristic polynomial .
Proof. The recurrence matrix for has eigenvalues . Since is a linear combination of and , it satisfies the recurrence with characteristic equation (trace = 18, determinant = 1 of the matrix ).
Lemma 2. From each Pell solution , the value must be a positive integer. This requires .
Proof. Since , we need . Checking: . By the recurrence, . Starting from : , , , … So or , i.e., always. Every Pell solution yields a valid triangle.
Editorial
The L values satisfy the recurrence L_{n+1} = 18*L_n - L_{n-1} with L_1 = 17, L_2 = 305. Sum the first 12 values. We advance to next solution. We then check m = (X - 2)/5 or (X + 2)/5 is positive integer. Finally, by Lemma 2, one always works.
Pseudocode
count = 12
Fundamental solution of X^2 - 5L^2 = -1
Advance to next solution
Check m = (X - 2)/5 or (X + 2)/5 is positive integer
By Lemma 2, one always works
else
Complexity Analysis
- Time: arithmetic operations for terms. With big-integer arithmetic, bit complexity is due to growing number sizes.
- Space: bits to store the current values.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
// L values satisfy L_{n+1} = 18*L_n - L_{n-1}
// L_1 = 17, L_2 = 305
// Sum the first 12 L values.
long long L_prev = 17;
long long L_curr = 305;
long long total = L_prev + L_curr;
for (int i = 3; i <= 12; i++) {
long long L_next = 18 * L_curr - L_prev;
total += L_next;
L_prev = L_curr;
L_curr = L_next;
}
cout << total << endl;
return 0;
}
"""
Problem 138: Special Isosceles Triangles
The L values satisfy the recurrence L_{n+1} = 18*L_n - L_{n-1}
with L_1 = 17, L_2 = 305.
Sum the first 12 values.
"""
def solve():
L_prev, L_curr = 17, 305
total = L_prev + L_curr
for _ in range(10): # 10 more to get 12 total
L_prev, L_curr = L_curr, 18 * L_curr - L_prev
total += L_curr
return total
if __name__ == "__main__":
answer = solve()
assert answer == 1118049290473932
print(answer)