Task: Given the area of a triangle, find a Heronian triangle with that area. Any Heronian triangle with the specified area is allowed.
A Heronian triangle is a triangle with integer sides and integer area. By Heron's formula, a triangle with sides lengths a,b,c
has area
sqrt(s*(s-a)*(s-b)*(s-c))
where s=(a+b+c)/2
is half the perimeter of the triangle. This can also be written as
sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c)) / 4
If no such triangle exists, output with a consistent falsey value.
Input: A single, positive integer representing the area of the triangle.
Output: Any three side lengths for such a triangle OR a falsely value.
Examples:
Input -> Output
6 -> 3 4 5
24 -> 4 15 13
114 -> 37 20 19
7 -> error
This is code golf, shortest answer in bytes wins.