divisibility of a Binary number

is there any ways to check binary divisibility without using modulo like (p%5==0) but rather using decrease and conquer algorithm.

i already now that to check whether a binary number is divisible by 5 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.

But i can't think of a way to solve it with a decrease and conquer algorithm

through research it suggested to use bitwise shift but i don't know how it is related to this problem or how to use it.
Topic archived. No new replies allowed.