Solution:
Recall that the notation a∣b means that a divides b. We say that a pair of positive integers (x,y) is nice if x∣N+y and 0<y<x−1 hold.
The first observation is that, given any positive integer x′, among x′ consecutive integers there is certainly a multiple of x′, so it is always possible to choose (uniquely) an integer y′ in the interval {0,1,…,x′−1} such that x′∣N+y′. The pair (x′,y′) is then nice provided that y′ is different from 0 and from x′−1. Equivalently, x′ is the first member of a nice pair if and only if x′ divides neither N+0=N nor N+(x′−1); this second condition is equivalent to the fact that x′ does not divide N−1.
Let us now consider the nice pair (x,y) for which x is minimal. By the above observation, x can divide neither N nor N−1. The conclusion is that there exists some prime power, say pk, that divides x but not N, and similarly there exists a prime power, say qh (not necessarily different from pk), that divides x but not N−1. Indeed, if every prime power dividing x also divided N, then x itself would divide N by unique factorization, but we have already seen that this cannot happen; the same reasoning applies to N−1.
Now observe that, if qh does not divide N, then qh divides neither N nor N−1, and therefore, by what we have already observed, qh is the first member of a nice pair. On the other hand qh divides x, so certainly qh≤x, and since x is minimal, we must have x=qh, a power of a prime, as desired. Similarly, if pk does not divide N−1, then x=pk and we are done.
We may therefore assume that pk∣N−1 and qh∣N; in this case pk and qh are distinct (recall that pk does not divide N) and, since both divide x, we get x≥2pk≥2p, x≥2qh≥2q.
To conclude, we show that in this case one of the numbers 2p, 2q is the first member of a nice pair, and therefore, by minimality, it must coincide with x. Indeed, if N is even then 2p works: clearly 2p cannot divide N−1, which is odd, and p (and a fortiori 2p) cannot divide N, because by hypothesis p divides N−1 and no prime divides two consecutive numbers. Similarly, if N is odd then 2q works: 2q (even) does not divide N (odd), and 2q does not divide N−1 because q divides N.