← All problemsSign in

Prime Range Game

CodeChefRating 2482Open on judge ↗

You are given positive integers $L$ and $R$, and a [prime number](https://en.wikipedia.org/wiki/Prime_number) $P$. Consider an array $A = [L, L+1, \ldots, R-1, R]$ of size $(R-L+1)$. Two players are playing a game on the array $A$. The player with the turn will: - Choose an index $1 \le i \le (R-L+1)$ and a **positive** integer $X$ such that $A_i$ is divisible by $P^X$. - Divide $A_i$ by $P^X$

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