J - Recursion
CodeChefOpen on judge ↗
Recursively define the sequence $X_1=1$, $X_{2 \cdot i} = X_i + 1$, and $X_{2 \cdot i + 1} = \dfrac{1}{X_{2 \cdot i}}$ Next, define $Y_i$ as the smallest positive integer such that $\dfrac{Y_i}{X_i}$ is an integer. It can be proven that such an integer always exists. You are given $2$ integers $L$ and $R$. Find $\sum_{i = L}^{R} Y_i$. Since the answer might be too large, output it modulo $998244
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