[Question]
  [
Given two positive integers \$n\$ and \$b\$, such that \$n > 2\$ and \$n > b > 1\$, count the trailing zeros when converting \$n\$ to base \$b\$. Your program should be able to handle any value of \$b\$ within your integer maximum.
The digits of \$n = 18\$, \$b = 3\$ are \$[2,0,0]\$, so the correct output is \$2\$.  
The digits of \$n = 107\$, \$b = 43\$ are \$[2, 42]\$, so the correct output is \$0\$
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins
## Test cases
```
  n   b  out
512   2   9
248   2   3
364 265   0
764   2   2
336 284   0
517 422   0
554  37   0
972   3   5
 12   6   1
 72   2   3
 44   2   2
 51  16   0
 32   2   5
 56   7   1
 60   2   2
  8   3   0
 18   3   2
107  43   0
```
---
Credit to [Anush](https://codegolf.stackexchange.com/users/98590/anush) for the [inspiration](https://chat.stackexchange.com/transcript/message/57752871#57752871)
There is a one byte answer in Jelly. Can you find it?
  
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 1 byte
```
Ǒ
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=%C7%91&inputs=2%0A512&header=&footer=)
*laughs in stolen jelly built-ins*
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), ~~11~~ 8 bytes
```
{*&|y\x}
```
[Try it online!](https://tio.run/##RU@7DsIwDNzzFTfxkkCNHScF/woTQxmQygISCPj2YqelDE7O1t35fNn2534YusNrs3g/j4/P0GG3XEkkkFJq7eWcQFm0@K/MGdQmlViQiFQkgYvuC4HVVFmLS5NzJSJmZe8lo2huDLXOq09jDrwegB7ACbjeb8EXA1774OtHzGEKYbgJHmScU5ji1PkUacQWy3JV7NmssZKA6p@tYkCh2R/p7wnLbcGrFvzjmFZ8Vkat3TLz0U7@xo8/TMEPtAt9/gU "K (ngn/k) – Try It Online")
* `|y\x` convert `x` to base `y`, reversing the resulting digits
* `&` use [monadic where](https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md#where), e.g. convert `0 0 2` into `2 2`
* `*` return the first value
[Answer]
# [Python 2](https://docs.python.org/2/), 31 bytes
Returns `False` for `0`.
```
f=lambda n,b:n%b<1and-~f(n/b,b)
```
[Try it online!](https://tio.run/##RYzNbsIwEITv@xRzQUqkQOP1X0DNs1S2KCJSMBYEoV766uniQDmM9tPszOSf6XhOPM@HfgynuA9ITdylVfxUIe3Xv4cqfcQm1vP9OIzfUDuSAGKD823K6HEKuRrS1OAS7l9DyrepqjfXPA5ya0K@yBMyIp0afV9qs1UM4KEtsemerEk7A3ZWuCUvvPhMWjtwZ4pvlYdhXtiKp33hrS8bIkso@06kCJ7/92Hem7BK3q50oV8Z6dqH55eua995dM99yasXM6lWsqb4fw "Python 2 – Try It Online")
[Answer]
# Jelly, 1 byte
```
ọ
```
[Try it online!](https://tio.run/##y0rNyan8///h7t7///@bm5n8NwIA "Jelly – Try It Online")
Don't know Jelly
[Answer]
# .NET Regex, 35 bytes
```
\G(?=1+,1(1+))(?=(1\1)+,)(?<-2>\1)+
```
[Try it online!](https://tio.run/##HYw5DkIxEEP7OQdICRmkP3uQWEou8QuQoKChQNw/TGjsZ8n25/l9ve9jW27ro8FmN9ZruZyoIRVqtSYXWqk2TDzu@Tx5DCNGBtaeKq7IbhDTQcSRu4JRoDKDmaIEHIJRIFcOMac6u0ZIDjKzOQb4ktRn7y9LPsgP "Retina 0.8.2 – Try It Online") Test suite written using Retina. Takes `n,b` as input in unary as strings of `1`s and outputs the result as the number of successful matches. Explanation:
```
\G
```
Each match must begin at the end of the previous match (with the first match beginning at the start of the string).
```
(?=1+,1(1+))
```
Look ahead to find `b` and capture `b-1` as `\1`.
```
(?=(1\1)+,)
```
Ensure that `1\1`, i.e. `b`, divides `n`.
```
(?<-2>\1)+
```
Subtract `b-1` times the quotient, leaving the quotient, i.e. `n/b`. This value is then the input to the next match.
[Answer]
# [Python 3](http://python.org), ~~83~~ ~~78~~ ~~57~~ ~~47~~ 40 bytes
```
f=lambda n,b:1+f(n/b,b)if n>n%b<=0else 0
```
*Finally figured out how to use a lambda to solve this*
[Answer]
# [JavaScript (V8)](https://v8.dev/), 22 bytes
*-3 thanks to @user*
```
d=>g=x=>x%d?0:g(x/d)+1
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/ifZvs/xdYu3bbC1q5CNcXewCpdo0I/RVPb8H9BUWZeiUaahpGmhrmZiabmfwA "JavaScript (V8) – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~11~~ 8 bytes
```
_YAPf1)q
```
Inputs are in reverse order.
[Try it online!](https://tio.run/##y00syfn/Pz7SMSDNULPw/39jLkMjYyNDAA) Or [verify all test cases](https://tio.run/##HYs7DoNADET7uQkd/i9lpByAgiZVkiZVKJC4/zKLLD@NR8/79/z3T3@/HutPpqM/t64IUXC8QTNg6bxqsDnMEq7DKVghghWWUiTurxpwhyQVRmOFSKacaTauNDg51wU).
### Explanation
Consider inputs `n = 12321`, `b = 3` as an example.
```
_    % Implicit input: b. Negate
     % STACK: -3
YA   % Implicit input: n. Convert n to specified base. A negative base -b is
     % interpreted as digits 0,1,...,b-1, and b can be arbitrarily large.
     % (A positive base b is interpreted as chars '0','1',...,'9','A','B',...,
     % and then b cannot exceed 36)
     % STACK: [1 2 1 2 2 0 1 0 0]
P    % Flip
     % STACK: [0 0 1 0 2 2 1 2 1]
f    % Find: indices of non-zeros
     % STACK: [3 5 6 7 8 9]
1)   % First entry
     % STACK: 3
q    % Subtract 1. Implicit display
     % STACK: 2
```
[Answer]
# MMIX, 28 bytes (7 instrs)
```
35020001 F7010000
1E000001 E7020001
FE030006 5303FFFD
F8030000
```
# Explanation
```
    NEG  $2,0,1     // set $2 to -1
    PUT  rD,0       // clear hidiv register
lop DIVU $0,$0,$1   // set $0 to $0/$1 and rR to $0%$1
    INCL $2,1       // increment $2
    GET  $3,rR      // $3 = rR
    PBZ  $3,lop     // if $3, jump back to loop
    POP  3,0        // return three registers; $2 goes into lowest slot!
```
The only tricks I used were to start the register at -1 to simplify the logic,
and to use the properties of `POP` to shift the register while returning.
The MMIX register shuffle is useful when golfing.
(It's possible to shave an extra tetra by using `DIV` instead of `DIVU` and omitting the `PUT`, but this changes the semantics to be signed instead of unsigned. For completeness, this leads to the following machine code.)
```
35020001 1C000001 E7020001
FE030006 5303FFFD F8030000
```
[Answer]
# [Raku](http://raku.org/), 22 bytes
```
{($^n,*/$^x.../\./)-2}
```
[Try it online!](https://tio.run/##JchNDoIwEAbQq3whjVGDbZjOtBihJzEQF3blX2ADQc5eU9y9vM99eLj0nLGLaNOyV92rPBrVTVprc9XmcKI1jbcZherRBiwRX9WvBeJ7QCMVgUKJhrj@wzoGOcn0mdtZB6o5UyoPpm1FGNZnnT3Bhkv6AQ "Perl 6 – Try It Online")
`$^n, * / $^x ... /\./` is a sequence starting with `$^n` (the first argument to the function), where each term is obtained by dividing the previous one by `$^x` (the second argument to the function), and ending when a term matches the regex `/\./` (ie, a period). Subtracting 2 from this sequence treats it as a number equal to its length.
[Answer]
# [Risky](https://github.com/Radvylf/risky), 8 bytes
```
0+02?}?0?+1*?:0
```
[Try it online!](https://radvylf.github.io/risky?p=WyIwKzAyP30_MD8rMSo_OjAiLCJbMTgsM10iLDBd)
## Explanation
```
0        0
+      +
0        0
2    prepend to
?        first input
}      base convert
?        second input
0  reduce
?        accumulator
+      +
1        1
*    ×
?        item
:      =
0        0
```
This problem translates really nicely to a Risky program. I had to add only two filler characters to make the tree symmetrical.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~38~~ 27 bytes
Saved 11 bytes thanks to [AZTECCO](https://codegolf.stackexchange.com/users/84844/aztecco)!!!
```
f(n,b){n=n%b?0:1+f(n/b,b);}
```
[Try it online!](https://tio.run/##bVLbboMwDH3vV1hIlaBNVSBc2jG2h2lfsaKpSUOHtqUVQRpaxa@POQmgdhpyHOf4@DgX@OrIed@XriTMu8hcztmjfxcsEVgzhLKur2QDn/tKut7sMgP8NNAI1bzKlwJyuMRBSCCMNgRoEhFItaM0IRAHKboYl9sUKZqm5yjSKeRgHCMt8QlgcaCHn3bZbRNmm@gWaEls5w1qRCFGFFtQ1LAwKtgoNZ4ai@iVpmjPgjfiYFW3huAbsj8atggMHl4tw4k2iPG3fb1AL/i7qFENtJ6za5/DXbt9whE7BK7X1Bkqy1MNrt5LJQ@ixTI/G8J7UNW3OJXuuEtvPQCLCclguTRsD@xzjCeTqDQ8i8kX2U2ajWn2b1ph2v4Ft7hAfLqzv4XnGiml68zpAfRYPcAcI7WTeHZJgBFQZLojkeeqGOS7Wdf/8PJjf1T96usX "C (gcc) – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 16 12 bytes
```
[:#.~0=#.inv
```
[Try it online!](https://tio.run/##XY8rDwIxEIQ9v2LDiQsJNH1ue02qSFAoLJJwgRPgkPz10mfaQ1TMt9OZ3cVvyTiDszDCHijY8A4EjpfzyV/tQL7UDeT5@vjd5n57vIHDDIrxLCZwayAK4NJkQCNAFZBAWROyR1eQPEZGj8CGJM/RuiGhI1Hln4okgEmXdhYABvC/TZ3XZtkVM0wlLTEaRBeYKnEdgLTbKWjTxlGy7niZANX@Bw "J – Try It Online")
-4 thanks to xash!
* `#.inv` Convert to list of base digits
* `0=` Converts zeroes to ones, everything else to 0.
* `[:#.~` Use that number as a mixed base to convert itself to a number -- effectively zeroes out everything to the left of the rightmost 0, summing all the ones (that were originally trailing zeroes).
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 9 bytes
```
valuation
```
[Try it online!](https://tio.run/##ddDBCsMgDAbg@56khQxMNNEe@jCehjA6Kd1e37kKPcx49eM3f5Ljnu6PXMonPt/xSK@tlLyn7Ziuh4mRgOZ1XebbP5ELJ9merDgg4YqmR//DSqTkrAAFp@cYPTiiAbID63VbPIGtxD3V7aQKKi1ptJwb1mcEFL2Dbd8pFVjA6xXEjAaFcx9lDDZRImjq9VrqCw "Pari/GP – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 15 bytes
```
IntegerExponent
```
[Try it online!](https://tio.run/##PY09C8IwFEX3/IpAwSlC8x0HpYuDm@AoDqGk2qFRSgYhpH89Jo/W7XDfvedNNrzcZMPY2zwc88UH93Tz@ft5e@dDvs6jD/dmfxq6rnnslltv/RJRlJQRzBJBkQmzEleikJKVNTCkXBUyorKkmmDBIJeyNLiueNBFxitVq4L9phebR1KCKdw43EpSxLBX7doxm@YPbX3IE0r5Bw "Wolfram Language (Mathematica) – Try It Online")
Built-in.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 11 bytes
```
ＩＬ⊟⪪⭆↨ＮＮ¬ι0
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwyc1L70kQyMgv0AjuCAns0QjuAQome6bWKDhlFicquGZV1Ba4leam5RapKGpo4DCBfL98ks0MkEMJQMlTRCw/v/f0tyIy/i/blkOAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
      Ｎ     Input `n`
     ↨      Converted to base
       Ｎ    Input `b`
    ⭆       Map over elements and join
         ι  Current element
        ¬   Logical Not
   ⪪      0 Split string on literal `0`
  ⊟         Take the last string of `1`s
 Ｌ          Take the length
Ｉ           Cast to string
            Implicitly print
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 34 bytes
```
\d+
$*
+%`^(1+),(\1)+$
¶$1,$#2$*
¶
```
[Try it online!](https://tio.run/##HYtLDsIwDET3vgaplBIv6k/scAIuUaEiwYINC8TZeoBeLDgs5mksv/k8v6/3vU/5uvX1USCdoUzbLVOZMa80lwTHngjTieN17L0zVmJgZG3AVlFM4/LBpihioDwcB3GsVUHw4gyG/5UPqAJZKFGFISyLZkuYLUINNLj4Dw "Retina 0.8.2 – Try It Online") Link includes test cases. Takes input in order `b,n`. Explanation:
```
\d+
$*
```
Convert `b` and `n` to unary.
```
+%`^(1+),(\1)+$
¶$1,$#2$*
```
Repeatedly divide `n` by `b`.
```
¶
```
Count the number of divisions.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 9 bytes
```
ḃ₎,0a₁=kl
```
[Try it online!](https://tio.run/##Pc07CgIxEIDhq4StI@Q1yVqoBwkpVgsFFwSbRWQLIwg24lFsBPE2yUViMmzsPmYmf9bHbrM79YetSOehIbMlaYZVvL2i9@F7H8P7mcLnGv2Dsi76y2Lfp2QtcEGJcJRYodpJUqssDcUGjVOps1pVDNxQogTOAfKFNIVzk2OyqFQ1vq95VTvAKeG4k3UHuYwBzaZJWzt/sPKjdO4H "Brachylog – Try It Online")
```
  ,0         Append a 0 to
ḃ₎           the digits of n in base b.
    a₁       Find the largest suffix
      =      all elements of which are equal,
       k     remove its last element,
        l    and output its length.
```
The shorter `ḃ₎a₁≡ᵛ⁰l` cannot handle cases with no trailing zeroes, since `a₁` cannot generate an empty suffix of a non-empty list, and if it could `≡ᵛ⁰` would fail on it anyhow.
Without utilizing base conversion:
# [Brachylog](https://github.com/JCumin/Brachylog), 11 bytes
```
⟨{f↔∋~^}h⟩t
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3w/9H8FdVpj9qmPOrorourzXg0f2XJ///R0aaGRjoKRrE6CtFGJhZQlrGZCZBlZgpim4PZYFFjMyDLwgTENjU011EwMQKLm5oCVRibg5iW5kDDjEEskKlmYP0w401g5pga6igYguWMYXKmQJPBBpgZQEUsYObAGQYgG41jYwE "Brachylog – Try It Online")
```
    ∋          An element
  f            of the list of factors
⟨{     } ⟩     of n
   ↔           in descending order
     ~^ h t    is b raised to the power of the output.
```
[Answer]
# [R](https://www.r-project.org/), 38 bytes
```
f=function(n,b)`if`(n%%b,0,1+f(n/b,b))
```
[Try it online!](https://tio.run/##jdFdC4IwFAbg@37FgRCUBrlvvfC3@BFag5pgRtSft9kodrPNq8F4eM/Ou2m5jM/61upXPU@tuip9rt/9NPb3ahmq4aFPsxp1qlGXNWpoUp0kHcoRPgypPnbmNvMGpBwTBAAkg705yp0XElY4kPohFQwBEdzC3A/lCv@JJJBIhUksWDSRY4mAERKHfB1NZRSW8lsPtZD7IdgehYU4ACXZ1iOwjfUAxwZiEV0GqDs6tAwXK5TxZUS@8Y1QOD2G3ohdGEjEuflrYL/E5QM "R – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), 48 bytes
```
f: func[n b][either(n % b)> 0[0][1 + f n / b b]]
```
[Try it online!](https://tio.run/##TZDNCoMwEITvPsVcCi09qPm1PfQheg05@JOgUFIR@/x2jWLMIXw7zM7CTK5b3q4zNlv8E/4XWhPQWOOGuXfTNeCC5vZCYQprStzhEZCjIYtd/HdyddsjbsBkoCdLRj@LzER1MFcCTMnImvjQuQKrxL6rIdimS0keriM/9JrJIyPmq411ugWRMimIfLuHnzxSrUsbqyLpqE75ictCUy7PrBmnIcwwY93lH@dn6oDjGJrzsPZDArXzBw "Red – Try It Online")
[Answer]
# [Julia](http://julialang.org/), 18 bytes
```
n*b=n%b<1&&1+n/b*b
```
[Try it online!](https://tio.run/##RZDNbsIwEITv@xRzKYIU0Xj9F6zmSSIfMOUAQqEiQaJPn24cSCytdjye/aT15XE9H9RzGNoi1e1H@larlfpsv1KRhv7U9R1qNGQVAxhrT2yql9aknQE7K7okL3rymbR24Mpk3yoPwzxpK572We99ZkhZQuY7KUXwPPNhFiaskmeXZ6HfGZm1o@enWVcueVQvvuTVWzOpUrJm8iPR7dHLinnVJmxVxK6YbyzvP@fu93r4WzcUWplBSMhtLR@2QTje7vfTsacZEDhiZMoZ265e4DpS3Az/ "Julia 1.0 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-g`](https://codegolf.meta.stackexchange.com/a/14339/), 5 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
ìV Ôð
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWc&code=7FYg1PA&input=MzY0CjI2NQ)
```
ìV Ôð     :Implicit input of integers U=n & V=b
ìV        :Convert U to a base-V digit array
   Ô      :Reverse
    ð     :0-based indices of truthy (non-zero) elements
          :Implicit output of first element
```
[Answer]
# [Emacs Lisp](https://www.gnu.org/software/emacs/manual/eintr.html), 45 bytes
```
(defun f(n b)(if(=(% n b)0)(+(f(/ n b)b)1)0))
```
[Try it online!](https://tio.run/##dY/NCsJADITvPkUuQhYRd7N/LcWHsdqFghax@vxrWihNYXtL8jGTme51u4/nZz@@c8ZHl34DJBygVdgnvOIRplkrPGHCy7y0yvBBZXx/@uELmMAbAgBSCpqGh/qwInKVRFYgGxxQ8AvSAkVGQkVSZQNQ5UoqbyI4oiLybGhjCdVxCm8X5AWCuVdYkJEo0l4vcLvhOSLbhFIMsBvDTQwf@BKLMYLe/QWV7LX5ZTZIqoyOXGBV5T8 "Emacs Lisp – Try It Online")
It seems that recursive functions doesn't work for Emacs Lisp on TIO.
[Answer]
# [Hy](http://hylang.org/), 40 bytes
```
(defn f[n b](if(% n b)0(+(f(/ n b)b)1)))
```
[Try it online!](https://tio.run/##dY@9CsJAEIR7n2IaYQ8L7/b@EvIoYhP00CaI2Pj0cQ2E7MGlG/ZjZmce33mm271MKJcJ45WehY4QZSydqNB50aNxxpiZXu/n9AEVRMcA2BgMg4j@sCEOnUZeIZ8COMUVWYWyIOVi7fIJ3IWWK7qMwNxEUQJ9bqE@/8v7FUWFsOxKK3IaZd7bhbBbXipKTGrVgK8CqxoxySU3ayS7@wud3lX9chXSLmezDNhc8w8 "Hy – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 32 bytes
```
a?b|a`mod`b>0=0|c<-a`div`b=1+c?b
```
[Try it online!](https://tio.run/##TY3LbsIwEEV/xWKVyINqj19BwvADdNUlQsQOlUAlgAotm/x7OuOCxO7c4@s7@3T9@jwexzEt85Da/rxr80JFNXTzaWp3h982Ry27ZR77dDiJKPp0ed@Ky8/t4/a9Oon1dX@@iyTlREykLCFziItnrmi5ZvX2ImLs6qFKkKGr59N15TQCwqyGCm1DZIiMt4DegSIOzIBsjQdsbLFOB7CI/@wsmFBwFmgAHBGtetD8Hx@j9rnjNGhf6obfuO08hNL26lFqaIcrmoGFVnSR3WYz/gE "Haskell – Try It Online")
[Answer]
# [Desmos](https://www.desmos.com/calculator), 64 bytes
```
c=[0...log_bn]
a=n/b^c
f(n,b)=max(c\left\{a=ceil(a):1,0\right\})
```
[Try It On Desmos!](https://www.desmos.com/calculator/nuosdv9lpq)
[Try It On Desmos(Prettified)!](https://www.desmos.com/calculator/lpza3i1nai)
Function to test on: \$f(n,b)\$
It seems like it only works if you copy/paste one expression at a time, instead of copy/pasting it all at once.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 27 bytes
```
f=->n,b{n%b>0?0:1+f[n/b,b]}
```
[Try it online!](https://tio.run/##RYzdasJAEIXv5ynmpqIYk93Zv2hdfQ3BirjRgGC3Ulvw99nTcaP14sDHN2fO9284NU3tB5OYhUt8CxMxFSPZr@exCFlY3JrKj8czMJIQ8Z4hkC4frEBZjWQNswDH3HoCpSxSqZM30qEmatmwUy7x0KUNjgFM@5YjAR3976N@baKRfLbpF9Wzw7/m7lz7a8Wrj@Vjn/vyyQRScFe3fgZQ5btt3Bwu1931mJ2ys6/yQ7WK3eJj3S96@edq3@2Mfr6W2977Hus5dxben2/NHw "Ruby – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 29 bytes
```
f=(n,b)=>n=n%b>0?0:1+f(n/b,b)
```
[Try it online!](https://tio.run/##XZBNa4NAEIbv/opBWlDcpKvrR740h0ChkHsOaSisbFohjGDsSfLb7btqQomsM7vPvvMctrzOymvVv/9yuam4FXQvRX/OPRbazwvO@VUXcitXYXD2@E2D9msHoeOJ@OtSUU5dEkaConghSKWxoMwWpVJBSZihJDguM0RszPY4tlfIYJ8glkpBGA7tL7PbXa8nvZVjpcnYF5iOI@wU5ArTI8bsuMuGqoYVq4fNTLblcCGHkLwvqMOBR/@O0SMGiXOuG/KgImuRa7TN8ADzveHv9gcgCHxyOofw2RwjZwPH6rR@QA2on6EBNM@wAcSLC9L@CHc1X@uLmR@aqjX7io334nZ8@2w7jTIrqGvQXQrIwyyMtCV3VzeNKUFX5H5wOZ18KG/9Hw "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# Excel, 52 bytes
```
=LET(x,SEQUENCE(LOG(A2,B2)),MAX(x*(MOD(A2,B2^x)=0)))
```
My first attempt below with built-ins was limited because `BASE` only works up to 36. As a bonus the second attempt was shorter. Goes to show, built-ins aren't always the answer.
## Initial Attempt, 70 bytes
```
=LET(x,BASE(A2,B2),q,SEQUENCE(LEN(x)),MAX(q*(RIGHT(x,q)=REPT("0",q))))
```
## Using LAMBDA from Insider Beta, 41 bytes
```
=LAMBDA(n,b,IF(MOD(n,b)=0,f(n/b,b)+1,0))
```
The above is 40 bytes plus 1 byte to set it equal to f in the Name Manager.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 5 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
вRĀ1k
```
First input is base \$b\$, second input is \$n\$.
[Try it online](https://tio.run/##yy9OTMpM/f//wqagIw2G2f//G3GZGhoBAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWXC/wubgo40GGb/1/kfHW1qaKRjFKsTbWRiAaaNzUx0jMxMgSxzEAskYmymY2RhAmSZGprrmBiBxExNTXSMzYEMS3MjHWMgDTTFDKQHYpgJRKepoY4hSNQYImpqpgPSYmYA5llA9EEpA6DJxrGxAA).
**Explanation:**
```
в      # Convert the (implicit) input `n` to the (implicit) input-base `b` as list
 R     # Reverse this list
  Ā    # Truthify each value (0 remains 0; everything else becomes 1)
   1k  # And get the first (0-based) index of a 1 in this list
       # (after which this index is output implicitly as result)
```
]