Unalike Gcd & Lcm
You are given an integer $X$. Answer $Q$ queries of the following form: - Given a positive integer $P$, count the number of positive integers $Y$ such that $$ (\gcd(X, Y))^P = \text{lcm}(X, Y) $$ Note that while there is no upper bound on the value of $Y$, it can be proved that for any $P$, the count of such $Y$ is always finite. Since the answer may be large, print it modulo $10^9 + 7$. ###
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