Hi Guys,

Came across this interesting question :

Given an integer N, find out all pairs of numbers a,b such that a^2+b^2 = N.

My approach is to find the floor of square root of N, and then try all
possible combinations from 1 to sqrt(N). Just wonder if I can do anything
better in the complex space ie, by expressing a^2+b^2 = (a + ib)(a - ib).
Any ideas or suggestions for better approaches?

-- 
Regards,
Shachindra A C

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to