This script gives the primitive triangles with integer sides and a 60° angle (resp 120°).
x² = u² + v² ± uv, GCD(x,u,v)=1
For all r and s coprime, r not a multiple of 3
r and s odd
u = |3s²-r²-2rs|/4 v = |3s²-r²+2rs|/4 x = (r²+3s²)/4
u = |3s²-r²-2rs| v = |3s²-r²+2rs| x = r²+3s²
If r<s or r>3s, angle is 60°, x² = u² + v² - uv
If s<r<3s angle is 120°, x² = u² + v² + uv
This script really searches, for every x value, all suitable r and s,
which gives the triangles sorted by increasing x.
Annexe A - values of x with |u-v|=1
4x²-1 = 3z² is a Pell equation X²-3z² = 1, restricted to X = 2x even.
X = 2, z = 1 is the fundamental solution, all solutions with X even are (2,1)2n+1,
product being defined as (a,b)*(u,v) = (au+3bv, av+bu).
That is zn+2 = 14zn+1-zn with z0 = -1, z1 = 1
Xn+2/2 = xn+2 = 14xn+1-xn with x0 = 1, x1 = 1
(For x = 1 the only triangle is u = v = 1. So x = 1 is rejected)