I am trying to solve the HackerRank version.
The problem statement,
Let us call an integer sided triangle with sides a ≤ b ≤ c barely obtuse if the sides satisfy $a^2 + b^2 = c^2 - 1$.
How many barely obtuse triangles are there with perimeter ≤ $75,000,000$
So the solution that I thought should work is finding the general solution for the above equation, and trying to check the numbers which satisfies all of them.
So this would be $O(n)$ in terms of time efficiency.
The solutions I found are: $a = 2m$, $b = 2m^2$ and $c = 2m^2 + 1$.
Where $ m \ge 1.$
This solution gives correct output for perimeter 21, which should give two triplets $(2,2,3)$ and $(4,8,9)$
But for $75,000,000$ it gives 4329 counts, which is very less than expected.
So now I am not able to understand why some numbers which should be solution are being excluded from this?
I also tried another general solution $a = 2m$, $b = \sqrt{2m}$ and $c = (m+1)$, but it also is giving same outputs as the above one.
I am not able to understand which specific solutions are being skipped in both solutions?