You should generate all the lucky numbers, less than 10^18, there shouldy not many of them. maybe 50. And then just submit program using hardwired array.
2009/1/6 Rahul Kushwaha <rahul.kushw...@gmail.com> > can anybody tell me which is best and correct solution > > On Tue, Jan 6, 2009 at 12:30 AM, Karthik Singaram Lakshmanan < > karthiksinga...@gmail.com> wrote: > >> >> Its not clear that just a primality test would close the deal...The >> sequence 1,3,7,13...does not have 5 which is prime. >> If you consider a number 'n' for it to be removed in round 2 (n%2)==0 >> For it to be removed in round 3 (n-floor(n/2))%3==0 (The floor of n/2 >> to accommodate all the numbers thrown out in round 2) >> For it to be removed in round 4 (n-floor(n/2)-floor(n/3))%4==0 (The >> floor of n/3 to accommodate all the numbers thrown out in round 3) >> >> Which is what is being done in the previously posted solutions.. >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---