Generating Integral Triangles with Sides $a$, $b$ and $c$ Satisfying $(a+b)(a+c)=kbc$

57 Views Asked by At

I'd like to ask how to generate all triangles with integer sides $a\leq b \leq c$ satisfying that $(a+b)(a+c)=kbc$, where $k$ is a given integer.

1

There are 1 best solutions below

0
On BEST ANSWER

I'll answer the answer by myself. Note that $k=(1+\frac{a}{b})(1+\frac{a}{c})$ whose value is between $2$ and $4$. Therefore, if $k \lt 2$ or $k \gt 4$, there is no such triangle. Otherwise, the equality can be transformed into $[(k-1)b-a][(k-1)c-a]=k a^2$. Thus, the triangles can be generated by first enumerating $a$ and then enumerating the factors of $k a^2$.