The problem statement is very easy. Given a number n you have to determine the largest power of m,not necessarily prime, that divides n!.InputThe input file consists of several test cases. The first line in the file is the number of cases to handle.The…