← All problemsSign in

Sereja and GCD

CodeChefRating 2396Open on judge ↗

In this problem Sereja is interested in the number of arrays of integers, A1, A2, ..., AN, with 1 ≤ Ai ≤ M, such that the greatest common divisor of all of its elements is equal to a given integer D. Find the sum of answers to this problem with D = L, D = L+1, ..., D = R, modulo 109+7. Input The first line of the input contains an integer T - the number of test cases. T tests follow, each cont

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start