[back]

Hypotenuse

Implement the function

val is_hypotenuse : int -> bool

so that is_hypotenuse n is true if and only if n is the hypotenuse of a right triangle with integer side lengths (i.e., there are a and b such that a * a + b * b = n * n).

Examples

let _ = assert (is_hypotenuse 5)
let _ = assert (is_hypotenuse 13)
let _ = assert (is_hypotenuse 17)
let _ = assert (is_hypotenuse 29)
let _ = assert (not (is_hypotenuse 28))
let _ = assert (not (is_hypotenuse 6))