is there any ways to check binary divisibility without using modulo like (p%3==0) but rather using decrease and conquer algorithm.
i already now that to check whether a binary number is divisible by 3 for example we have to take the number of even bits minus the number of odd bits and if it is a multiple of 3 (e.g. -3,0,3,6, etc) then the number is divisible by three.
i have been suggested to use shiftbit operators but i have never used it and don't understand how i could use it to solve this problem.
https://stackoverflow.com/questions/66616174/binary-division March 14, 2021 at 12:57AM
没有评论:
发表评论