[algogeeks] Re: Primality testing

2013-04-15 Thread Don
Trial division is fine for small numbers, perhaps up to 10 digits. But think for a moment about what that would take for a 1000 digit number. The square root of such a number is 500 digits. There are about 10^496 primes smaller than 10^500. If you have a billion computers each checking a billion

[algogeeks] Re: Primality testing

2013-04-15 Thread Don
For numbers larger than what can be stored in your computer's native integer types, you should use an extended precision math library. NTL is one such option. It provides a type called ZZ which supports integer operations where the size is limited only by your computer's memory and speed. Don On

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

[algogeeks]

2013-04-15 Thread w.s miller
suppose we have n processing units.we have an incoming traffic which is to be distributed among them.but we have to take in mind that load is to be equally distibuted and if one of the processing units goes down ,then we have to distribute the traffic to rest of the processing units.Also when the