Use sieve algorithm for generating the primes and then check for the condition of twin numbers.......
Regards Aviral http://coders-stop.blogspot.com/ On Jan 11, 10:20 pm, ankit agarwal <ankit.agarwal.n...@gmail.com> wrote: > as all prime no. greater than 3 are of the form 6n+1 or 6n-1 > so start checking for all these numbers and if they both are prime > then they will make pair > count the pair no. as well as u move on > > Ankit > > On Jan 11, 9:23 pm, snehal jain <learner....@gmail.com> wrote: > > > you will be given an input no. n u have to output nth twin pair.. > > for eg input 1 output(3,5) > > input 5 output (29,31) > > > twin pair is a pair in which prime no. differ by 2.. (3,5) , (5,7) > > (11,13), (17,19) (29,31) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.