This is problem is a harder version of "Problem 44747. Exponents in Factorials". https://ww2.mathworks.cn/matlabcentral/cody/problems/44747
It's time to get excited about numbers!!! Well, we're just dealing with factorials here, but it's still a good reason to get excited. You're given two numbers, n and k. Calculate the highest exponent of k that could appear in n!
For example, for n=5 and k=2, you're looking for the highest exponent of 2 that could appear in 5!, or 120. The highest power of 2 that evenly divides 120 is 3 (2^3 evenly divides 120, while 2^4 does not) so your output for maxexp(5,2)=3.
You can assume that both n and k are both integers greater than 1. 1<=n<=1e9, 2<=k<=100.
Your solution is the same with mine, even the variable names.
Why?
Are you cheating?
I know, you just copy my solution in "Problem 44747. Exponents in Factorials".
@li haitao, it doesn't matter. It is hard to say James copy your solution. It is possible two codes are same in cody. Even copy, please don't mind. I also copy other's code to solve cody problem.
@Binbin Qi,
I don't mind, I just curious in the beginning.
A few minutes later, I know the reason, but I can not delete the comments, may be there are some bugs in cody sites.
@li haitao, there is a button named Delete which is bule in southeast of the comment box.
Find the sum of all the numbers of the input vector
27205 Solvers
Which values occur exactly three times?
3400 Solvers
172 Solvers
Parse string and identify specific string sequence in algebraic equation
44 Solvers
185 Solvers
Solution 1656984
Your solution is the same with mine, from the alogrithm view.
Your code style is MATLAB style, while my solution is C/ C++ style.
Yes, I saw your solution and change it to vector style.