Editorial for Nearest Co-Prime

If an integer $N$ is divisible by $x$, then $N + x$ is also divisible by $x$. If we want to find the smallest number that is coprime to $N$, we will choose $x$ in such a way, that both $N$ and $N + x$ is not divisible by $x$. Since we want to find the smallest such $x$, in order to find the smallest number co-prime with $N$, we will choose $x$ = 1. Thus, the answer will be $N + 1$ for each of the cases.

Statistics

95% Solution Ratio