[algogeeks] Re: prime or not

2007-03-29 Thread Karthik Singaram L
In case you are wondering about the part of the proof for k%3<>0, it goes like this, the given number can be written as 1 + 1000 + 100 + 10 +..and so on now if for a given k, if we choose the string of k 1s and try to find the modulus with each of the terms in the above expression, for

[algogeeks] Re: prime or not

2007-03-29 Thread Karthik Singaram L
well...its simple as given in the article.. note that the numbers are all decimal numbers (not binary..in case misled by just 0 and 1 in the number) therefore if you have have k copies of 001 and k%3 == 0, then the sum of the digits is divisible by 3 hence the number is divisible by 3 - The Standa