A math teacher wants to give his students an interesting geometry problem.
He has the following idea (Fig. 1):
Let \$AB\$ and \$CD\$ be two chords of a circle with center \$M\$, intersecting orthogonally at point \$S\$. Find the lengths of \$CS\$ and \$DS\$ if \$AS\$ is \$n\$ cm, \$BS\$ is \$m\$ cm, and the circle radius is \$r\$ cm.
Now he needs to choose the appropriate values for \$n,\:m\$ and \$r\$ for the problem. According to established convention, where possible, both the results and the given values are integers. This would allow the students to intuitively understand whether their solution is correct. Unfortunately, the math teacher cannot find a combination of three integer input values that would result in two integers.
The Challenge
Write a program or a function that will find all possible combinations of the three segments [m, n, r] that have integer lengths and integer solutions.
Input and output
A program or a function that inputs a limiting number \$X\$ and outputs all combinations of \$m, n, r ≤ X\$.
The output is arranged such that \$m\$ and \$n\$ precede \$r\$.
Rules
In this challenge, a chord cannot be equal to the diameter: \$AB \ne 2 \cdot r\$ and \$CD \ne 2 \cdot r\$
The lengths of the chords are different \$AB \ne CD\$
This is code-golf. Standard i/o. Standard loopholes.
Test case:
X = 100:
m n r
[1,] 4 76 85
[2,] 9 41 65
[3,] 4 44 25
[4,] 8 22 25
[5,] 6 72 65
[6,] 8 58 65
[7,] 17 49 65
[8,] 11 91 85
[9,] 23 49 85
[10,] 8 88 50
[11,] 16 44 50
[12,] 14 64 65
[13,] 9 39 25
[14,] 13 27 25
[15,] 15 87 85
[16,] 27 53 85
[17,] 23 55 65
[18,] 24 66 75
[19,] 38 64 85
[20,] 32 88 100
[21,] 17 95 65
[22,] 19 85 65
[23,] 18 78 50
[24,] 26 54 50
[25,] 21 99 65
[26,] 27 77 65
[27,] 36 68 65
[28,] 27 93 65
[29,] 31 81 65
[30,] 39 81 75
[31,] 30 96 65
[32,] 40 72 65
[33,] 55 81 85
[34,] 38 88 65
[35,] 44 76 65
[36,] 62 88 85
[37,] 64 90 85

2, 14, 10is not a solution? \$\endgroup\$2, 14, 10,1,7,5etc. have one thing in common: the x and y coordinates of the intersection are equal, and both chords are split equally. These solutions are in some sense trivial. I understood "a diagonal cannot be a solutionm+n<2r" to mean "a diameter cannot be a solution" but it seems the intent may indeed have been to exclude solutions where the intersection falls on a diagonal as well as ones where a chord is a diameter. I will wait for OP response but that's the only way I can explain the test cases. \$\endgroup\$(m,n,r)=(1,7,5)(with CS=BS) now looks valid. For X=100, I believe this would lead to 74 solutions instead of 37. \$\endgroup\$