Given a number $N$ and a prime $P$, how many numbers $\leq N$ are divisable by P but not by any smaller primes?

65 Views Asked by At

The following Math Exchange question deals with a similar problem:

Not divisible by $2,3$ or $5$ but divisible by $7$

However, the answers given become infeasible quite quickly because the amount of permutations increases too rapidly as P grows.