It is all about prime factors
CodeChefOpen on judge ↗
Gagan has challenged Mayank to do a task: The problem consists of 3 parts. 1.Given 5 prime numbers p1,p2,p3,p4 and p5. Find the first K distinct natural numbers of the form (p1^a1)*(p2^a2)*(p3^a3)*(p4^a4)*(p5^a5). a1,a2,a3,a4 and a5 are assumed to be whole numbers. 2.Sort the K numbers found. 3.For each number X among first K natural numbers found of such form, set X = X % 1000007. Since Ma
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