Given a value N, find the maximize value of value of (a+b) such that a^2-b^2 = N

Note: The value of N is odd. a and b are integers.

For eg if n = 1

The value of aa - bb is 1. The maximum value occurs when a=1 and b=0.

Thus, a+b = 1.

I know it's anser will always be n.

But can anyone help me in knowing that how it answer will always be n.


Note that $a \neq b$. $a+b=\frac N {a-b}$ Since $|a-b| \geq 1$ we get $a+b \leq N$. The value $N$ is attained when $a=\frac {N+1} 2$ and $b=\frac {N-1} 2$

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.