[Math] the Max value of n when 185! is divided by (189^n) will give an Integer Value

number theory

What is the Max value of n when $185!$ is divided by $(189^n)$ will give an Integer Value?

Options are

a) $91$
b) $30$
c) $36$
d) $24$

MyApproach:

$189$=$3^3$ . $7$

When $185$/$3$=$61$

$61$/$3$=$20$

$20$/$3$=$6$

$6$/$3$=$2$

Its Remainder Sum=$89$

$185$/$7$=$26$

$26$/$7$=$3$

Its Remainder Sum=$29$

So,3^89 . $7$^$29$

$27$^$29$ . $7$^$29$

I am getting $29$ as the final Ans.

Required Ans is 30
Why i am getting the Ans wrong?
Also,

Is there any better approach i can solve this problem.

Best Answer

Well,

Prelude> let m = product [1 .. 185] :: Integer
Prelude> m `mod` (189^29)
0
Prelude> m `mod` (189^30)
37470960172551150153411831285317353601062526805310229978097429296724

it's not you who is wrong. Your result is correct, the required answer is incorrect.

Is there any better approach I can solve this problem?

Not really, counting the (relevant) prime powers dividing the factorial is the best method generally.