well..will this work?

x + y = SUM(1:N+2) - SUM(array) = a
x^2 + y^2 = SUM(1^2:(N+2)^2) - SUM(array.^2) = b
so (a^2 - b) = 2xy

so xy = (a^2-b)/2 = k (say)

now,

x + (k/x) = a

x^2 + k = ax
(x, y) = (a +/- sqrt(a^2-4k))/2

I may not have written the equations correctly (need coffee !!!)
but you get the general idea...
solve a quadratic equation to solve for (x+y) = a and (x^2 + y^2) = b

- Karthik

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to