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 <[email protected]> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
