← All problemsSign in

Sum of N

CodeChefRating 1789Open on judge ↗

Define $f(X)$ as the largest [divisor](https://en.wikipedia.org/wiki/Divisor) of $X$ other than $X$ itself. For example, $f(12) = 6$ and $f(7) = 1$. Note that $f(1)$ is defined to be $0$. Given an integer $K$, find the **sum** of all $N$ such that $f(N) = K$. It can be shown that the answer does not exceed $10^{18}$ under the given constraints. ### Input - The first line of input will contai

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