Take an easier example then we can segue into the actual question.
What’s the highest p possible for \frac{\text{7!}}{\text{7}{^p}} to be an integer?
>> Ans is 1
What if I do \frac{\text{(7+1)!}}{\text{7}{^p}}
>> Ans is still 1
Side Note: I chose 7! as a simple test case given I’d be dividing by 7^p, you could have chosen any other number.
Applying that same logic to the question,
What is the highest possible p for \frac{\text{n!}}{\text{7}{^p}} to be an integer?
>> Ans is x according to question.
What if I do \frac{\text{(n+1)!}}{\text{7}{^p}}
>> Ans is (x+3) according to question.
So, we need a number, n that:
- Its factorial, n! has x 7s
- And (n+1)! has (x+3) 7s
342 is that number, n because 343 = 7³ introduces three 7s when 342 increases by 1 to become 343.