Sarthak and his Set of Primes
Sarthak has a set $S$ of $N$ distinct prime numbers. He grew very fond of that set, and now he only likes a positive integer $X$ if all of its prime factors belong to $S$. Given the set and a positive integer $M$, can you find out how many integers he likes which are not more than $M$? **Note:** Sarthak always like the number $1$. ### Input - The first line of each input contains $T$ - the numbe
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start