bool is_lucky(int x){ int pos=x; inr count=2; while(count<pos){ if(pos%count) return 0; pos=pos-pos/count; count++; } return 1; }
On Sun, Aug 5, 2012 at 1:11 PM, dheeraj hasija <dheerajhasija1...@gmail.com>wrote: > @daksh paaji kya baat hai thanks for the solution. aap har jagah hai :P > > > On Sat, Aug 4, 2012 at 12:21 AM, Daksh Talwar <dakshtal...@gmail.com>wrote: > >> maintain a bool array of size of limit of int >> store true for lucky numbers >> and then cross check using the function. >> create the bool array like the one they show in the wiki page >> >> -- >> 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?hl=en. >> > > -- > 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?hl=en. > -- 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?hl=en.