Sunday, December 25, 2011

Efficient Algo to generate Prime numbers

After doing some little research for a prime number generation in Project euler. Just come to the conclusion that the below algorithm is the Most efficient algo for generating prime numbers.

Considerations:
1.Except 2 and 3 , all primes can be represent in the form of 6n+1 or 6n-1. [This leads to the conclusion that all primes are odd and it is not divided by  3.
2.And if a number is not divided by all the numbers below sqrt(number) then its a prime.
So it leads to the following pseudo code..

// Generating prime after 2 and 3
1.Read n
2.Divide it by the all odd numbers(above 3) less than sqrt(n).


P.s: Its 3 times faster than the usual code.If you know an efficient code other than this . Do comment that algo.

Multilpe login in gtalk

Follow these steps..
1. Right-click on the desktop
2. Select New
3. Select Shortcut
4. Paste this into the text box:

"c:\program files\google\googletalk\googletalk.exe" /nomutex
(dont miss even a comma)

5. Click Next
6. Name it whatever: Google Talk Multiple, etc.
7. Click OK until you are done.

P.S: The post is done assuming your gtalk is in the c:\program files. If not replace it by your current directory address.

Tuesday, December 13, 2011