Prime Multiples
You are given k distinct prime numbers a_1,a_2,\ldots,a_k and an integer n. Your task is to calculate how many of the first n positive integers are divisible by at least one of the given prime numbers. Input The first input line has two integers n and k. The second line has k prime numbers a_1,a_2,\ldots,a_k. Output Print one integer: the number integers within the interval 1,2,\ldots,n that
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