2

I have been through the wikipedia page, but wanted to know if there was a preferred (most efficient) method when there is an exact solution to find?

  • binary search it takes O(logN) – advocateofnone Jan 21 '15 at 12:14
  • 1
    How big a number? Do you have a calculator or is this mental arithmetic? – Henry Jan 21 '15 at 12:15
  • You can immediately tell the number of digits of $\sqrt{N}$ using the number of digits on $N$ and by looking at the number of digits of $N$. Like Henry says, the optimal method may be different if you have more information for the size of $N$; there are very fast algorithms for small $N$, e.g., $N < 10^4$. – Travis Willse Jan 21 '15 at 12:16
  • Have you already tried http://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division ? – lhf Jan 21 '15 at 12:34
  • Typically I am talking about solutions that are a maximum of 2^128 which is obviously very large. I would be doing this using a computer program running on a very low power device and am trying to make this as efficient as possible. – KenInLondon Jan 21 '15 at 15:22

0 Answers0