Sereja and GCD 2
Sereja asks you to find out number of arrays A of size N, i.e. A1, A2, ..., AN (1 ≤ Ai ≤ M), such that for each pair i, j (1 ≤ i i, Aj) = 1. As the answer could be large, print it modulo 109 + 7 (1000000007). Input First line of the input contain an integer T - number of test cases. T tests follow. First line of each test case contain two space separated integers N, M. Output For
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