Editorial for Nearest Co-Prime

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

    Statistics


    95% Solution Ratio

    mahade31Earliest, 5M ago

    chandlerFastest, 0.0s

    nfs277Lightest, 0 B

    imamanik05Shortest, 21B

    Toph uses cookies. By continuing you agree to our Cookie Policy.