Re: [algogeeks] Primality testing

2013-04-15 Thread Bharat Singhvi
If time complexity is not the issue and you just need to find the square root of the number and iterate over [2,sqrt(num)] then one way in which it can be done is by using BigInteger class of Java. You will need to write your own method to compute square root of BigInteger. Read

Re: [algogeeks] Primality testing

2013-04-14 Thread Bharat Singhvi
http://en.wikipedia.org/wiki/AKS_primality_test On Sun, Apr 14, 2013 at 10:46 PM, payel roy smithpa...@gmail.com wrote: You are to test whether a number if prime or not. Digit of that number can be as large as 1000. How do you do that? I was thinking of basic idea. a) First I shall

Re: [algogeeks] Primality testing

2013-04-14 Thread payel roy
I read that.. but still not understanding how you would solve for a number having 1000 digits. Would be great if you can explain with an example. On 14 April 2013 22:48, Bharat Singhvi bharatsinghvi.1...@gmail.com wrote: http://en.wikipedia.org/wiki/AKS_primality_test On Sun, Apr 14, 2013