"what math?"
Logical proofs and statistical knowledge should be sufficient.
I assume that you will realize the purpose after you acquire said knowledge.
"omg math no"
q = (b[p] * b^p)
Assume that 'b' refers to the numerical base.
Assume that 'p' refers to the position within the binary number supplied.
I have simplified the process for you. You are welcome.