Skip to main content
4 of 7
added 31 characters in body
Uriel
  • 13.2k
  • 4
  • 17
  • 45

Dyalog APL, 11 bytes

2 bytes saved thanks to @ZacharyT

⊣-⍨⊢*1+∘⌊⍟⍨

Try it online!

Takes n as left argument and b as right argument.

Calculates b⌊logbn + 1⌋ - n.

Uriel
  • 13.2k
  • 4
  • 17
  • 45