Given A number N conver it to 2 square form

54 Views Asked by At

I have a number N i want to subtract square of x from N , where x is any integer

Num = N-x*x

Such that Num can be represent as square of two numbers.

i.e Num= a^2+b^2  where a and b are integers

As far as i know to represent a number summation of two square it's prime factor of form 4k+3 should occur even times.

But how to determine x in most efficient way ?
i tried some random cases it's always possible to do so