check if discriminent is a perfect square and if it as perefect root of the equation
if ( $ sq * $ sq == $ s && check ( ( int ) ( ( $ sq - $ i ) / 2 ) , $ i ) ) { $ found = true ; $ mx = min ( $ mx , ( int ) ( ( $ sq - $ i ) / 2 ) ) ; } }