How far away is n to the next power of b?
Jelly, &nbsp;4&nbsp; 3 bytes

ạæċ


A dyadic link taking n on the left and b on the right and returning the result.

Try it online!

How?

ạæċ - Link: number n, number b | n,b ∈ ℕ
 æċ - ceiling n to the next power of b
ạ   - absolute difference between n and that