# Dyalog APL, 10 bytes

*2 bytes saved thanks to @ZacharyT*

    ⊢-⍨⊣*1+∘⌊⍟

[Try it online!][1]

Takes `n` as right argument and `b` as left argument.

Calculates <code>b<sup>⌊log<sub>b</sub>n + 1⌋</sup> - n</code>.

  [1]: http://tryapl.org/?a=f%u2190%u22A2-%u2368%u22A3%2A1+%u2218%u230A%u235F%20%u22C4%202%202%205%205%203%20f%208%20212%20563%20491%20424&run