There are a few really good randomized algorithms on primality testing. The AKS algorithm is i guess the best know deterministic primality testing algo.
On Sat, Jun 28, 2008 at 1:22 PM, Sumedh Sakdeo <[EMAIL PROTECTED]> wrote: > > u can refer this site... its very cool... > http://www.troubleshooters.com/codecorn/primenumbers/primenumbers.htm > > On 6/27/08, Arunachalam <[EMAIL PROTECTED]> wrote: > > What is the maximum value of number that you need to find out? > > > > A 32 bit number is prime if it satisfies the Fermat's theorem for 2,3,5,7 > > and 11. This is the fastest way to find out whether a number is prime or > > not. > > > > regards, > > Arunachalam. > > > > On Fri, Jun 27, 2008 at 12:46 AM, rowdy ranga <[EMAIL PROTECTED]> > > wrote: > > > >> > >> > >> hello sir, > >> ya it is possible in o(n).dnt worry > >> first we use a principle of sieve of erasthones > >> printf("nter no"); > >> scanf("%d",&num); > >> if((num%2)==0||(num%3)==0||(num%5)==0||(num%7)==0) > >> printf("notprime"); > >> else > >> int i=2; > >> for(;i<num/2;i++) > >> { > >> if((num%i)==0) > >> printf("not prime "); > >> else printf("prime"); > >> > >> > > >> > > > > > > -- > > =================================== > > want to know more about me > > http"//ww.livejournal.com/users/arunachalam > > > > > > > > > > > -- Ciao, Ajinkya --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---