sorry my solution is wrong.... i missed that the number should be divisible by a number of that type.
On 6/24/10, nisha goyal <nisha.goyal1...@gmail.com> wrote: > let n be the number. > > a) if n is zero, then it is of the form 2^k-1. > b) if n is negative then replace n with -n. > c) take m=n+1. > d) check if m&(m-1)==0 > then n is of the form 2^k-1, otherwise not. > > > On 6/23/10, divya <sweetdivya....@gmail.com> wrote: >> u are given any binary no...... u have to check its divisbility by >> 3,7,15, >> 31......(any no. of the form 2^x-1) >> .u cant use any division >> and modulo operator for that..... >> >> -- >> 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. >> >> > -- 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.